f = int(input()) if f - 7 <= 0 or (f - 7) % 7 == 0: print(-1) else: print(f-7)