#include<bits/stdc++.h>
using namespace std;
void func(int n){
    string res;
    if(n == 0) cout << "0";
    else{
        while(n > 0){
            int remain = n % 8;
            res += to_string(remain);
            n /= 8;
        }
        reverse(res.begin(), res.end());
        cout << res;
    }
}
int main(){
    int n;
    string res;
    while(cin >> n){
        func(n);
        cout << endl;
    }
}

func函数可以求一个Int型整数的八进制表示,将8换为其他数即可求得其他的进制表示,to_string()将数值类型转换为字符串