#include<bits/stdc++.h>
using namespace std;
string a,w,c="0123456789ABCDEF";
int main()
{
    cin>>a;
    if(a.size()%4==3) a='0'+a;
    else if(a.size()%4==2) a="00"+a;
    else if(a.size()%4==1) a="000"+a;
    for(int i=0;i<a.size();i=i+4){
        w=a.substr(i,4);
        cout<<c[(w[3]-'0')*1+(w[2]-'0')*2+(w[1]-'0')*4+(w[0]-'0')*8];
    }
    return 0;
}
/**************************************************************
	Problem: 1294
	User: lijinkai
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:2076 kb
****************************************************************/