n = int(input()) ans = 0 i = 0 while i < n: i += 1 if i % 7 == 0: n += 6 print(i)