#include<bits/stdc++.h>
using namespace std;
int a[100],w;
string b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string h(int n,int k)
{
string ans;
while(n)
{
ans+=b[n%k];
n/=k;
}
return ans;
}
int main()
{
int k;
cin>>k;
string x,y;
int ix,iy;
cin>>ix>>iy;
x=to_string(ix);y=to_string(iy);
ix=stoi(x,nullptr,k);
iy=stoi(y,nullptr,k);
ix+=iy;
x=h(ix,k);
reverse(x.begin(),x.end());
cout<<x;
return 0;
}