#include using namespace std; int main() { int N; cin >> N; if (!N) return cout << 0 << "\n", 0; string ans; while (N) ans = to_string(N % 7) + ans, N /= 7; cout << ans << "\n"; }