#include using namespace std; int main() { int p, q, n; cin >> p >> n >> q; //现将P进制转换为十进制 int t = 0, f = 1; while (n != 0) { t = (n % 10) * f + t; f = f * p; n = n / 10; } //现在将十进制转换为Q进制 int y[100], num = 0; do { y[num++] = t % q; t = t / q; } while (t != 0); //输出结果 for (int i = num - 1; i >= 0; i--) { cout << y[i]; } return 0; }