#include int main () { int n = 0; int m = 0; int res = 0; int lenans = 0; char ans[40] = ""; int c = 0; res = scanf("%d", &n); res = scanf("%d", &m); while (m > 0) { ans[lenans] = ((char)(m%n))+'0'; lenans++; m /= n; } ans[lenans] = '\0'; for (int i = 0; i < lenans/2; i++) { char tmp = ans[i]; ans[i] = ans[lenans-i-1]; ans[lenans-i-1] = tmp; } printf("%s\n", ans); return 0; }