#include #include #include int main(void){ unsigned long long n; scanf("%llu",&n); unsigned long long m=0,keta=1; while(n>=7){ m+=(n%7)*keta; keta*=10; n=n/7; } m+=n*keta; printf("%llu\n",m); return 0; }