#include #include #include #include #include #include #include #include #include #include #include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() using namespace std; int main() { long long N; cin >> N; int r = N % 7; int q = 1; while (N >= q * 7) { q *= 7; } int a = -1; while (N>0 && q!=0) { a = N / q; N = N%q; q /= 7; cout << a; } if (r == 0) { cout << 0 << endl; } }