#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;
    cin>>n;
    int x=0;
    string k;
    for(int i=0;i<n.size();i++){
        if(n[i]<='9'&&n[i]>='0'){
            x=n[i]-48;
            //cout<<t[x];
        }
        if(n[i]<='F'&&n[i]>='A'){
            x=n[i]-55;
            //cout<<t[x];
        }
        k=k+t[x];
    }
    while(k[0]=='0'){
        k.erase(0,1);
    }
    if(k==""){
        cout<<0;
    }
    else
    cout<<k;
}
/**************************************************************
	Problem: 1306
	User: luyanchen
	Language: C++
	Result: Accepted
	Time:12 ms
	Memory:2080 kb
****************************************************************/