a = int(input()) if a == 0: print(-1) exit() for i in range(1, a+1): if i <= 7: continue if i+7 == a: print(i) exit() else: print(-1)