N=int(input()) for i in range(1,10**7+1): if i%7==0: N+=6 N-=1 if N==0: print(i) break