import std.stdio, std.string, std.conv, std.algorithm; import std.range, std.array, std.math, std.typecons, std.functional; void main() { int n = readln.chomp.to!int; ten2seven(n).writeln; } long ten2seven(long n) { if (n == 0) return 0; long res = 0; int off = 0; while (n > 0) { res += 1L * n % 7 * 10L^^off; n /= 7L; off++; } return res; } unittest { assert(ten2seven(18) == 24); assert(ten2seven(7) == 10); assert(ten2seven(1000000000) == 33531600616); }