#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int x;
    cin>>n;
    string s;
    while(n!=0){
        x=n%8;
        char c=x+'0';
        n=n/8;
        s=c+s;
    }
    if(s==""){
        cout<<0;
    }
    else{
        cout<<s;
    }
}

/**************************************************************
	Problem: 1288
	User: luyanchen
	Language: C++
	Result: Wrong Answer
****************************************************************/