#include #include using namespace std; #define ll long long ll N, M; int main() { cin >> N >> M; if (M==0) {cout << M << endl;return 0;} string ans = ""; ll k = N; while (M > 0) { ll rem = M % N; ans += char('0'+(rem)); M /= N; } reverse(ans.begin(), ans.end()); cout << ans << endl; }