#include<iostream>
#include<stack>
#include<string>
using namespace std;
class Colors
{
public:
int R, G, B;
string MC;
void EtM()
{
MC += "#";
string r, g, b;
r = Change(R);
g = Change(G);
b = Change(B);
MC += (r + g + b);
}
private:
string Change(int c)
{
string rgb;
stack<int> color;
while (c)
{
color.push(c % 13);
c /= 13;
}
while (!color.empty())
{
int col = color.top();
color.pop();
As(rgb, col);
}
if (rgb.length() == 1)
{
string RGB;
RGB = '0' + rgb;
return RGB;
}
if (rgb.length() == 0)
rgb = "00";
return rgb;
}
void As(string &rgb,int col)
{
if (col < 10)
{
rgb += '0'+col;
}
else
{
switch (col)
{
case 10: rgb += "A"; break;
case 11: rgb += "B"; break;
case 12: rgb += "C"; break;
}
}
}
};
int main()
{
Colors C;
cin >> C.R >> C.G >> C.B;
C.EtM();
cout << C.MC << endl;
system("pause");
return 0;
}