import sys input = sys.stdin.readline n=int(input()) for i in range(1,20000): if i%7==0: n+=6 n-=1 if n==0: print(i) break