#include using namespace std; int main() { int N, M; cin >> N >> M; vector ans; while (M) { ans.push_back(M % N); M /= N; } reverse(ans.begin(), ans.end()); for (int d : ans) { cout << d; } cout << endl; return 0; }