#include<iostream>
#include<vector>
using namespace std;
#include<algorithm>

vector<int> add(vector<int>a,vector<int>b){
    vector<int>c;
    int t=0;
    for(int i=0;i<a.size()||i<b.size();i++){
        if(i<a.size()) t+=a[i];
        if(i<b.size()) t+=b[i];
        c.push_back(t%10);
        t/=10;
    }
    if(t) c.push_back(1);
    return c;
}

void trans(vector<int>a,int b){
   vector<int>res;
   //reverse(a.begin(),a.end());
   while(a.size()){
    int r=0;
    for(int i=a.size()-1;i>=0;i--){
        a[i]+=r*10;
        r=a[i]%b;
        a[i]/=b;
    }
     res.push_back(r);
     while(a.size()&&a.back()==0) a.pop_back();
   }

   for(int i=res.size()-1;i>=0;i--){
        cout<<res[i];
        //if(res[i]<9) cout<<res[i];
        //else cout<<res[i]+10-'A';
    }
    
}

int main()
{
    int m;string a,b;
    cin>>m>>a>>b;
    vector<int>A;
    vector<int>B;
    for(int i=a.size()-1;i>=0;i--) A.push_back(a[i]-'0');
    for(int i=b.size()-1;i>=0;i--) B.push_back(b[i]-'0');
    auto c=add(A,B);
    trans(c,m);
}