def Main(): now=1 n=int(input()) while True: if now%7==0: n+=6 n-=1 if n==0: print(now) return now+=1 Main()