#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); int N, M; cin >> N >> M; vector res; while (M > 0) { res.push_back(M % N); M /= N; } int siz = res.size(); rep(i, 0, siz) cout << res[siz - i - 1]; cout << '\n'; }