#include<iostream>
#include<string>
#include<vector>
using namespace std;

//习题6.1 八进制
int main()
{
    int num;
    while (cin >> num) {
        vector<int> nums;
        while (num != 0) {
            nums.push_back(num % 8);
            num /= 8;
        }
        for (int i = nums.size() - 1; i >= 0; i--) {
            cout << nums[i];
        }
        cout << endl;
    }


    return 0;
}
// 64 位输出请用 printf("%lld")