#include int main(){ long long int N; int out[100], mod; long long int i = 0, j = 0; scanf("%lld", &N); do{ mod = N%7; N /= 7; out[i++] = mod; }while(N >= 7); out[i++] = (int)N; for(j = 0; j < i; j++){ if(j != i - 1){ printf("%d", out[i - 1 - j]); }else{ if(out[i - 1 - j] != 0){ printf("%d", out[i - 1 - j]); } } } printf("\n"); return 0; }