#include using namespace std; typedef unsigned long long ull; typedef long long ll; int main(){ ll n; cin >> n; if(n==0){ cout << 0 << endl; return 0; } vector v; while(n>0){ v.push_back(n%7); n/=7; } for(int i=v.size()-1; i>=0; i--) cout << v[i]; cout << endl; return 0; }