#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) template inline bool chmax(T&a,T b){if(a inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;} using ll = long long; int n; int main () { cin.tie(0); ios::sync_with_stdio(false); cin >> n; vector ans; if(n==0) ans.push_back(0); while(n) ans.push_back(n%7), n/=7; for(int i=ans.size()-1;i>=0;i--) cout << ans[i]; cout << endl; }