/*
3127
#include <stdio.h>
#define SIZE 201
int stack[SIZE];
int top=-1;
void push(int data)
{
if(top==SIZE-1) return;
stack[++top]=data;
}
int pop()
{
if(top==-1) return -1;
return stack [top--];
}
int main()
{
char str[201];
int p,q,i,num=0;
gets(str);
for(i=0;str[i]!=NULL;i++)
{
if(str[i]>='0'&&str[i]<='9')
{
num=num*10+str[i]-'0';
if(str[i+1]==' ')
{
push(num);
num=0;
}
}
else if(str[i]== '*')
{
p=pop();
q=pop();
push(q*p);
}
else if(str[i]=='+')
{
p=pop();
q=pop();
push(q+p);
}
else if(str[i]=='-')
{
p=pop();
q=pop();
push(q-p);
}
}
for(i=0;i<=top;i++)
{
printf("%d", stack[i]);
}
return 0;
}
*/
/*
3021
#include <stdio.h>
#include <string.h> //
#define SIZE 101
char stack [SIZE];
int top=-1;
void push(char data)
{
if(top==SIZE-1) return;
stack[++top]=data;
}
char pop()
{
if(top==-1) return -1;
return stack [top--];
}
int main()
{
char a[101]={}, b[101]={},temp[101]={};
int i,lena,lenb,t=0,c=0,num=0,x,y;
scanf("%s", a);
scanf("%s", b);
lena=strlen(a);
lenb=strlen(b);
if(lena<lenb)
{
strcpy(temp,a); //str 사용중에 temp 쓸때
strcpy(a,b);
strcpy(b,temp);
t=lena;
lena=lenb;
lenb=t;
}
//for(i=lena-1,j=lenb-1;i>=0;i--,j--)
for(i=lena-1;i>=0;i--)
{
x=a[i]-48;
if(i-lena+lenb<0)
y=0;
else
y=b[i-lena+lenb]-48;
num=x+y+c;
push(num%10);
c=num/10;
}
if(c!=0) push(c);
while(top!=-1)
{
printf("%d", pop());
}
return 0;
}
*/
/*
3129
#include <stdio.h>
int main()
{
char str[50001]={};
int i,top=0;
scanf("%s", str);
for(i=0;str[i]!=NULL;i++)
{
if(str[i]=='(') top++;
else
{
top--;
if(top<0)
{
printf("bad");
return 0;
}
}
}
if(top==0)
{
printf("good");
}
else
{
printf("bad");
}
return 0;
}
*/