#include<iostream>
using namespace std;
void Shu(long long num=0)
{
if(num>7)
Shu(num/8);
cout<<num%8;
}
int main()
{
long long num=0;
while(cin>>num)
Shu(num);
return 0;
}
#include<iostream>
using namespace std;
void Shu(long long num=0)
{
if(num>7)
Shu(num/8);
cout<<num%8;
}
int main()
{
long long num=0;
while(cin>>num)
Shu(num);
return 0;
}