#include<bits/stdc++.h>
using namespace std;
stack<int> st;
int main(){
string s;
cin>>s;
int w=0,l=s.size();
for(int i=l-1;i>=0;i--){
w+=pow(8,(l-i-1)%4)*(s[i]-'0');
if((l-i-1)%4==3){
while(w!=0){
int a=w%16;
if(0<=a&&a<=9) st.push(a);
else st.push(a);
w/=16;
}
}
}
while(w!=0){
int a=w%16;
if(0<=a&&a<=9)
if(a==0) st.push(a);
else st.push(a);
else st.push(a);
w/=16;
}
while(!st.empty() ){
if(st.top()>=0&&st.top()<=9)
cout<<st.top();
else
cout<<char(st.top()+87);
st.pop();
}
return 0;
}