#include #include #include using namespace std; int main() { int n; cin >> n; string s=""; if(n==0) { cout << 0 << endl; return 0; } while(n>0) { s+=to_string(n%7); n/=7; } reverse(s.begin(),s.end()); cout << s << endl; }