#include<iostream>
using namespace std;
int main()
{
string a,b;
long long i,t=1,sum=0,sum1;
cin>>a;
for(i=a.length()-1;i>=0;i--)
{
if(a[i]>='0' && a[i]<='9')
a[i]-='0';
else
a[i]=a[i]-'A'+10;
sum+=a[i]*t;
t*=16;
}
for(i=0;sum!=0;i++)
{
b[i]=sum%8+'0';
sum/=8;
}
if(sum1==0)
cout<<'0';
else
for(i=i-1;i>=0;i--)
cout<<b[i];
cout<<endl;
}
01-28
7976
03-15
6999
08-05
10万+
02-02
1467
02-17
1751
01-25