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