#include <iostream> #include <algorithm> using namespace std; int main() { long long a, b, c; int m; while (cin >> m && m != 0) { cin >> a >> b; c = a + b; string res = ""; do { res += c % m + '0'; c = c / m; } while (c != 0); reverse(res.begin(), res.end()); cout << res << endl; } return 0; }