#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int M=0;
int N=0;
cin>>M>>N;
string a;
int count=0;
if(M==0)
{
a+='0';
}
else
{
if(M<0)
{
count++;
M*=(-1);
}
while(M)
{
int m=M%N;
if(m>=10)
{
a+='A'+m-10;
}
else
{
a+=m+'0';
}
M/=N;
}
}
if(count)
{
a+='-';
}
reverse(a.begin(),a.end());
cout<<a;
return 0;
}



京公网安备 11010502036488号