#include<stdio.h>
int fun(int m, int k)
{
int a[32], i=0;
for (i = 0; m > 0; i++)
{
a[i]=m%k;
m /= k;
}
for (i--; i>=0; i--)
printf("%d", a[i]);
return 0;
}
int main()
{
int b, n, c;
printf("qingshuru m,k:");
scanf_s("%d%d", &n, &b);
c = fun(n, b);
printf("%d\n", c);
return 0;
}