#include<bits/stdc++.h>
using namespace std;
int main()
{
string t[16] = {
"0000","0001","0010","0011","0100","0101",
"0110","0111","1000","1001","1010","1011",
"1100","1101","1110","1111"
};
string n,k;
int x = 0;
cin>>n;
for(int i = 0;i<n.size();i++)
{
if(n[i]<='9' && n[i]>='0')
{
x = n[i]-48;
}
if(n[i]<='Z' && n[i]>='A')
{
x = n[i]-55;
}
k=k+t[x];
}
while(k[0] == '0')
{
k.erase(0,1);
}
if(k == "")
{
cout<<0;
}
else
{
cout<<k;
}
}
/**************************************************************
Problem: 1306
User: wuyichen
Language: C++
Result: Accepted
Time:12 ms
Memory:2080 kb
****************************************************************/