#include<iostream> #include<cstdio> #include<vector> using namespace std; int main() { int m, A, B; while (scanf("%d", &m) != EOF) { if (m == 0) { break; } scanf("%d%d", &A, &B); long long number = A + B; vector<int> resultant; if (number != 0) { while (number != 0) { resultant.push_back(number % m); number /= m; } for (int i = resultant.size() - 1; i >= 0; --i) { printf("%d", resultant[i]); } } else{ printf("0"); } printf("\n"); } return 0; }