#include #include #include #include #include using namespace std; int main(){ int n; cin >> n; int b; string res = ""; while(true){ b = n%7; res.push_back(to_string(b)[0]); if(n/7 == 0){ if(n/7 == 1)res.push_back('1'); break; }else{ n /= 7; } } for(int i=res.length()-1; i>-1; i--) cout << res[i]; cout << endl; }