#include int main(){ long in; int i,out[100000]; scanf("%ld\n",&in); for(i=0;in>6;i++){ out[i]=in%7; in/=7; } out[i]=in; while(i>=0){ printf("%d",out[i]); i--; } printf("\n"); return 0; }