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