#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    int a[100]={0},k=0;
    cin>>n;
    if(n==0){
        cout<<"0";
    }
    else{
        while(n!=0){
            a[k++]=n%8;
            n=n/8;
        } 
        for(int i=k-1;i>=0;i--){
            cout<<a[i];
        }
    }
      
    return 0;
}
/**************************************************************
	Problem: 1288
	User: xuanhua
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2072 kb
****************************************************************/