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