N=int(input()) for i in range(1,N): if N//i==1 and N%i==7: print(i);exit() print(-1)