N = int(input()) now = 1 while N > 0: N -= 1 if now % 7 == 0: N += 6 now += 1 print(now - 1)