#include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace atcoder; typedef long long ll; #define rep(i,n) for (int i = 0; i < int(n);i++) int main(){ int n,m; cin >> n >> m; string ans; while(m > 0){ int d = m%n; ans += char('0'+d); m/=n; } if (ans == "") { cout << 0 << endl; return 0; } reverse(ans.begin(),ans.end()); cout << ans << endl; return 0; }