#include <iostream>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> bas_change(vector<int> A, int ob, int nb)
{
vector<int> C;
vector<int> D;
while (A[0] != 0 || A.size() > 1)
{
int r = 0;
for (int i = A.size() - 1; i >= 0; --i)
{
r = r * ob + A[i];
C.push_back(r / nb);
r %= nb;
}
reverse(C.begin(), C.end());
while (C.size() > 1 && C.back() == 0)
C.pop_back();
A = C;
C.clear();
D.push_back(r);
}
return D;
}
int main()
{
string a;
cin >> a;
vector<int> A;
for (int i = a.size() - 1; i >= 0; --i)
A.push_back(a[i] - '0');
auto res = bas_change(A, 10, 2);
reverse(res.begin(), res.end());
auto ans = bas_change(res, 2, 10);
for (int i = ans.size() - 1; i >= 0; --i)
cout << ans[i];
return 0;
}