N=int(input()) for i in range(8,100): if i+7==N: print(i) exit() print(-1)