#include #include #include using namespace std; int main(){ int N; cin >> N; string S; while (N > 0){ S += '0' + N % 7; N /= 7; } reverse(S.begin(), S.end()); cout << S << endl; }