Problem2209--ABC162B - FizzBuzz Sum

2209: ABC162B - FizzBuzz Sum

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Problem Statement

Let us define the FizzBuzz sequence a_1,a_2,...a1,a2,... as follows:
  • If both 33 and 55 divides iia_i=\text{FizzBuzz}ai=FizzBuzz.
  • If the above does not hold but 33 divides iia_i=\text{Fizz}ai=Fizz.
  • If none of the above holds but 55 divides iia_i=\text{Buzz}ai=Buzz.
  • If none of the above holds, a_i=iai=i.
Find the sum of all numbers among the first NN terms of the FizzBuzz sequence.

Constraints

  • 1 \leq N \leq 10^61N106

Input

Input is given from Standard Input in the following format:
NN

Output

Print the sum of all numbers among the first NN terms of the FizzBuzz sequence.

Sample Input Copy

15

Sample Output Copy

60

HINT

The first 1515 terms of the FizzBuzz sequence are:

1,2,\text{Fizz},4,\text{Buzz},\text{Fizz},7,8,\text{Fizz},\text{Buzz},11,\text{Fizz},13,14,\text{FizzBuzz}1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz

Among them, numbers are 1,2,4,7,8,11,13,141,2,4,7,8,11,13,14, and the sum of them is 6060.

Source/Category