#include int main() { int d = 7; int n; long r = 0; std::cin >> n; for (long i = 1; n > 0; i *= 10) { r += i * (n % d); n /= d; } std::cout << r << std::endl; }