#include using namespace std; int main() { int N, M; cin >> N >> M; vector ans; while(M != 0) { ans.push_back(M % N); M /= N; } for(int i = (int)ans.size() - 1; i >= 0; i--) cout << ans[i]; cout << endl; return 0; }