x = [-1] * 101 for i in range(8, 100): k = i + 7 if k > 100: break x[k] = i a = int(input()) print(x[a])