#include <algorithm>
#include <iostream>
#include <iterator>
using namespace std;

string s;

string transform(int m, int n, string num)
{
    int remain;
    string res = "";
    for(int i = 0; i < num.size(); )
    {
        remain = 0;
        for(int j = i; j < num.size(); j++)
        {
            int k = (remain * m + num[j] - '0') % n;
            num[j] = (remain * m + num[j] - '0') / n + '0';
            remain = k;
        }
        res += char(remain + '0');
        while(num[i] == '0') i++;
    }
    reverse(res.begin(), res.end());
    return res;
}

int main() {
    while(cin >> s)
    {
        string s1 = transform(10, 2, s);
        reverse(s1.begin(), s1.end());
        string res = transform(2, 10, s1);
        cout << res << endl;
    }
}