#include<iostream>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<string>
#include<algorithm>
#include <cstdlib>
#include<stdlib.h>
#include<sstream>
#include<stack>
using namespace std;
char a[40] = { '0','1','2','3','4','5','6','7','8','9',
'a','b','c','d','e','f','G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y','Z' };
int main()
{
stack <char>stk;
string s;
cin >> s;
unsigned long long count = 0;
unsigned long long p;
for (int i = s.length()-1; i>=0;i--)
{
count = count + (s[i] - '0') * pow(8, s.length() - i - 1);
}
while (count != 0)
{
p = count % 16;
stk.push(a[p]);
count = count / 16;
}
while (!stk.empty())
{
cout << stk.top();
stk.pop();
}
return 0;
}