#include using namespace std; #ifdef LOCAL #include "algo/debug.hpp" #else #define debug(...) ((void)0) #endif int main() { constexpr char endl = '\n'; std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, m; cin >> n >> m; string ans = ""; while (m) { ans += to_string(m % n); m /= n; } reverse(ans.begin(), ans.end()); cout << (ans == "" ? "0" : ans) << endl; }