n = int(input()) total_sum = 0 inc = 1 while True: if inc % 2 != 0 and inc % 3 != 0: if total_sum + inc > n: break total_sum += inc inc += 1 print(total_sum)
To embed this project on your website, copy the following code and paste it into your website's HTML: