/*
#include <stdio.h>
int main()
{
int a=0, b=0, c, n=0;
scanf("%d %d", &a, &b);
if (a-b<0)
{
n+=((a-b)*-1)/10;
c=((a-b)*-1)%10;
}
else if (a-b==0)
{
printf("0");
return 0;
}
else
{
n+=(a-b)/10;
c=(a-b)%10;
}
if (c==1||c==5)
{
n++;
}
else if (c==2||c==4||c==6||c==9)
{
n+=2;
}
else if (c==3||c==7||c==8)
{
n+=3;
}
printf("%d", n);
return 0;
}
//Implement stack
#include <stdio.h>
#define size 10
int stack[size];
int top=-1;//data가 없다
//top= data가 마지막으로 들어온 위치
void push(int a)
{
//is full???
if(top==size-1)
{
printf("stack is full!!\n");
return ;
}
stack[++top]=a;
}
void pop()
{
//is empty??
if(top==-1) {
printf("stack is empty!!\n");
return ;
}
printf("pop data is :%d\n",stack[top--]);
}
void view()
{
for( int i=0; i<=top; i++)
{
printf("%d ",stack[i]);
}
printf("\n");
}
int main()
{
int a,b,c;
while(1)
{
printf("1.push 2.pop 3.view 4.exit>>");
scanf("%d",&a);
if(a==1)
{
printf("insert data >>");
scanf("%d",&b);
push(b);
}
else if( a==2)
{
pop();
}
else if(a==3)
{
view();
}
else
{
return 0;
}
}
}
#include <stdio.h>
int stack[100000];
int top=-1;
void push(int a)
{
stack[++top]=a;
}
int pop()
{
return stack[top--];
}
int main()
{
int a, n=0, s,i;
scanf("%d", &a);
for (i=0;i<a;i++)
{
scanf("%d", &s);
if (s==0)
{
pop();
}
else
{
push(s);
}
}
while(top!=-1)
{
n+=pop();
}
printf("%d", n);
return 0;
}
*/
//#include <stdio.h>
//#include <string.h>
//int stack[200];
//int top=-1;
//void push(int a)
//{
// stack[++top]=a;
//}
//int pop()
//{
// return stack[top--];
//}
//int main()
//{
// int l, n, i, s;
// char arr[200];
// scanf("%d ", &l);
// scanf("%s", arr);
// for (i=l-1;i>=0;i--)//
// {
// push(arr[i]-'0');
// }
// for (i=0;i<l;i++)
// {
// printf("%d",pop());
// if (top%3==2)
// {
// printf(",");
// }
// }
// return 0;
//}
//#include <stdio.h>
//
//int main()
//{
// int a, b, i;
// char Str[201];
// scanf("%d", &a);
// scanf("%s", Str);
// b=a%3;
// for (i=0;i<a;i++)
// {
// if ((i%3==b)&&i>0)
// {
// printf(",");
// }
// printf("%c", Str[i]);
// }
// return 0;
//}
/*
#include <stdio.h>
#include <string.h>
int stack[100]={0};
int top=-1;
void push(int a)
{
stack[++top]=a;
}
int pop()
{
printf("%d", stack[top--]);
}
int main()
{
int i;
char arr[100];
scanf("%s", arr);
for (i=0;i<strlen(arr);i++)
{
push(arr[i]-'0');
}
for (i=0;i<strlen(arr);i++)
{
pop();
}
return 0;
}
*/