#include using namespace std; int main () { int N, M; cin >> N >> M; if (M == 0) { cout << 0 << endl; return 0; } stack st; while (M) { st.push(M % N); M /= N; } while (!st.empty()) { cout << st.top(); st.pop(); } cout << endl; }