def main(): limit = int(input('')) total = 0 number = 1 while number < limit: if number % 3 == 0 or number % 5 == 0: total += number number += 1 print(total)