#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,k=0,a[10000];
    cin>>n;
    if(n==0){
    	cout<<0;
    }
    while(n!=0){
    	a[k]=n%8;
    	n=n/8;
    	k++;
    }
    for(int i=k-1;i>=0;i--){
    	cout<<a[i];
    }
	return 0;
}

/**************************************************************
	Problem: 1288
	User: chenlingxuan
	Language: C++
	Result: Accepted
	Time:10 ms
	Memory:2072 kb
****************************************************************/