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

string DecToHex(int n)
{
    string hex = "";
    while (n)
    {
        int digit = n % 6;
        hex = to_string(digit) + hex;
        n /= 6;
    }
    return hex;
}

int main() {
    int n;
    cin >> n;
    cout << DecToHex(n) << endl;
}
// 64 位输出请用 printf("%lld")