n = int(input()) rem = n for d in range(1, 10 * n + 1): if d % 7 == 0: rem += 6 rem -= 1 if rem == 0: print(d) exit()