#include<bits/stdc++.h>
using namespace std;
int main()
{
string t[8] = {
"000","001","010","011","100","101","110",
"111"
};
string n,k;
int x = 0;
cin>>n;
for(int i = 0;i<n.size();i++)
{
if(n[i]<='9' && n[i]>='0')
{
x = n[i]-48;
}
k=k+t[x];
}
while(k[0] == '0')
{
k.erase(0,1);
}
if(k == "")
{
cout<<0;
}
else
{
cout<<k;
}
}
/**************************************************************
Problem: 1359
User: wuyichen
Language: C++
Result: Accepted
Time:34 ms
Memory:2080 kb
****************************************************************/