A = int(input()) for x in range(8, 10**6): if x+7 == A: print(x) exit() print(-1)