#include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
string a;
cin>>n;
if(n==0){
cout<<0;
}else{
while(n!=0){
a=char(n%8+'0')+a;
n=n/8;
}
cout<<a;
}
return 0;
}
/**************************************************************
Problem: 1288
User: wuzhijing
Language: C++
Result: Accepted
Time:6 ms
Memory:2072 kb
****************************************************************/