#include <stdio.h> long six(int n){ if(n == 0) return 0; else return n % 6 + six(n / 6) * 10; } int main() { int n; scanf("%d", &n); printf("%ld", six(n)); return 0; }