#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n, m; cin >> n >> m; if (m == 0) { cout << 0 << endl; return 0; } vector ans; while (m) { ans.push_back(m % n); m /= n; } reverse(ans.begin(), ans.end()); for (int a : ans) { cout << a; } cout << endl; }