#include <bits/stdc++.h>
using namespace std;
void func(int m,long x){
vector<int>v;
while(x!=0){
v.push_back(x%m);
x/=m;
}
for(auto it = v.rbegin();it!=v.rend();it++)
cout<<*it;
cout<<endl;
}
int main() {
long m,a,b;
while(cin>>m>>a>>b){
if(a+b == 0)cout<<0<<endl;
else func(m,a+b);
}
}
// 64 位输出请用 printf("%lld")
int会溢出

京公网安备 11010502036488号