n=int(input()) for i in range(1,100): if n%i==7 and n//i==1:print(i);break else:print(-1)