#include #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD % 1000000007 using namespace std; typedef long long LL; typedef vector VI; int main() { int n; cin >> n; VI nn(101); VI::iterator it = nn.begin(); while (n) { *it = n % 7; it++; n /= 7; } do { if (it != nn.begin()) it--; cout << *it; } while (it != nn.begin()); cout << endl; return 0; }