#include std::vector convert_base_to(int64_t val, int64_t base){ if(val == 0) return {0}; std::vector ret; while(val){ if(val < base){ ret.push_back(val); break; } ret.push_back(val % base); val /= base; } return ret; } int64_t convert_base_from(const std::vector &val, int64_t base){ int64_t ret = 0; for(auto it = val.rbegin(); it != val.rend(); ++it){ (ret *= base) += *it; } return ret; } int main(){ int N; std::cin >> N; auto res = convert_base_to(N, 7); std::reverse(res.begin(), res.end()); for(auto x : res) std::cout << x; std::cout << "\n"; return 0; }