#include<bits/stdc++.h>
using namespace std;
//mytrans作用:将字符串(m进制)转换为字符串(n进制)的逆序
void mytrans(string &s,int m,int n)
{
    string res="";
    for(int i=0;i<s.length();)
    {
        int yushu=0,t;
        for(int j=i;j<s.length();j++)
        {
            t=yushu;
            yushu=(yushu*m+s[j]-'0')%n;
            s[j]=(t*m+s[j]-'0')/n+'0';
        }
        res+=yushu+'0';
        while(s[i]=='0') i++;
    }
    s=res;
}
int main()
{
    string s;
    while(cin>>s)
    {
        mytrans(s,10,2);
        mytrans(s,2,10);
        reverse(s.begin(), s.end());
        cout<<s<<endl;              
    }
}