A = input() L = [i for i in A] ans = -1 if int(A) >= 15: for i in range(8,94): if i*1 + 7 == int(A): ans = i break if i*1 + 7 > int(A): break print(ans)