#include "bits/stdc++.h" using namespace std; int main() { int n; cin >> n; vector ans; do ans.push_back(n % 7); while (n /= 7); reverse(begin(ans), end(ans)); for (auto num : ans) cout << num; cout << endl; }