#include<stdio.h>
int main() {
    unsigned int temp[100000];
    unsigned int n, count = 0;
    scanf("%d", &n);
    unsigned int val = n;
    while (val > 0) {  //十进制转六进制计算
        temp[count++] = val % 6;  //储存输出值
        val /= 6;
    }
    while (count--) {  //反向输出储存值
        printf("%d", temp[count]);
    }
    return 0;
}