n = io.read("*n") d = 1 while true do if d % 7 == 0 then n = n + 6 end n = n - 1 if n == 0 then print(d) os.exit() end d = d + 1 end