#include <iostream> #include <vector> using namespace std; int main() { int base; while(cin>>base && base!=0){ long long a,b; cin>>a>>b; long long n=a+b; if(n==0) { cout<<0<<endl; continue;} vector<int> ar; while(n>0){ ar.push_back(n%base); n/=base; } for(int i=ar.size()-1;i>=0;i--) cout<<ar[i]; cout<<endl; } } // 64 位输出请用 printf("%lld")