//利用递归实现6进制的转换
#include<iostream>
using namespace std;
//函数体
void func(int n) {
    int remainder = 0;
    if (n == 0);
    else {
        remainder = n % 6;
        func(n/6);
        cout << remainder;
    }
}
int main()
{
    int n;
    cin >> n;
    func(n);
}