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