#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); long long int n; string res = ""; cin >> n; while(n > 0) { char c = (char)(n%7 + '0'); n/=7; res = c + res; } cout << res << '\n'; return 0; }