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