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