def base10_to_n(X,n): b = X n_str = "" while b: n_str = str(b % n) + n_str b//=n return n_str N = int(input()) to7 = base10_to_n(N,7) print(to7)