#include<iostream>
using namespace std;
string calc(int a)
{
string s;
while(a)
{
char c;
if(a%13<=9)c=(a%13)+'0';
else c=(a%13)-10+'A';
s=c+s;
a/=13;
}
if(s.size()==1)s='0'+s;
if(s.size()==0)s="00";
return s;
}
int main()
{
int r,g,b;
cin>>r>>g>>b;
string s1,s2,s3;
s1=calc(r);
s2=calc(g);
s3=calc(b);
cout<<'#'<<s1<<s2<<s3<<endl;
return 0;
}