#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; if (n == 0) { dunk(0); return 0; } string ans = ""; while (n > 0) { ans += to_string(n % 7); n /= 7; } reverse(all(ans)); dunk(ans); return 0; }