#include #include using namespace std; int main(){ long N; int M=0; long ans=0; cin>>N; while(N!=0){ ans+=pow(10,M)*(N%7); M++; N/=7; } cout<