#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LONG_INF 10000000000000000 #define MAX_MOD 1000000007 #define REP(i,n) for(long long i = 0;i < n;++i) int main() { long long n; cin >> n; if (n == 0) { cout << 0 << endl; return 0; } string s; while (n != 0) { s.push_back('0' + n % 7); n /= 7; } reverse(s.begin(), s.end()); cout << s << endl; return 0; }