#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int a[32];
void process(int sum,int m)
{
int i = 0;
int j;
while(sum)
{
a[i++] = sum % m;
sum /= m;
}
for(j = i-1; j >= 0; j--)
printf("%d",a[j]);
printf("/n");
}
int main()
{
int m,a,b;
int sum;
scanf("%d",&m);
while( m != 0)
{
scanf("%d %d",&a,&b);
sum = a+b;
if(sum == 0) //!!!!
printf("0/n");
else
{
process(sum,m);
}
scanf("%d",&m);
}
return 0;
}