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