#include <bits/stdc++.h> using namespace std; int main () { int N, M; cin >> N >> M; stack<int> st; while (M) { st.push(M % N); M /= N; } while (!st.empty()) { cout << st.top(); st.pop(); } cout << endl; }