#include#include using namespace std;const int maxn = 510;int a[maxn],s[maxn];int main(){ int i,j,k,m,n; scanf("%d%d",&n,&k); m=n; int top=0; while(m){ s[++top]=m%k; m/=k; } i=1; while(top)a[i++]=s[top--]; j=--i; for(i=1;i<=j;i++)printf("%d",a[i]); return 0;}