#include using namespace std; int main() { int n, m; cin >> n >> m; if (m == 0) { puts("0"); return 0; } string ans = ""; while(m) { ans += '0' + (m%n); m /= n; } reverse(ans.begin(), ans.end()); cout << ans << endl; return 0; }