#include<bits/stdc++.h> using namespace std; void op(int n,int m) { if(n == 0) return ; else { op(n/m,m); if((n%m) >= 10) { cout << (n%m)-10+'A'; } else { cout << (n%m); } } } int main() { int n,m; cin >> n >> m; op(n,m); return 0; }