#include <bits/stdc++.h> using namespace std; typedef long long LL; int main(){ LL a_num; LL b_num; int a = 10; int b; while (cin >> b >> a_num >> b_num){ LL c_num = a_num + b_num; string a_line = to_string(c_num); vector<int> number; for (auto item:a_line){ number.push_back(item-'0'); } reverse(number.begin(), number.end()); vector<int> res; while (number.size()){ int r = 0; for (int i=number.size()-1; i>=0; i--){ number[i] = number[i] + a*r; r = number[i] % b; number[i] = number[i] / b; } res.push_back(r); while (number.size() && number.back() == 0) number.pop_back(); } reverse(res.begin(), res.end()); for (auto item:res){ cout << item; } puts(""); } return 0; }