#CCBCHBON0000021. Bỏ bội của cả 2 và 3 (Skip Multiples of Both Two and Three)

Bỏ bội của cả 2 và 3 (Skip Multiples of Both Two and Three)

Skip Multiples of Both Two and Three

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

For nonnegative nn, sum the integers from 1 through nn that are not divisible by both 2 and 3. Equivalently, skip multiples of 6; integers divisible by only one of 2 or 3 must still be included. Print 0 when n=0n=0.

Input

One integer 0≤n≤1000000\le n\le100000.

Output

Print the sum as a 64-bit integer.

Subtasks

  • Subtask 1 (20%): 0≤n≤100\le n\le 10.

  • Subtask 2 (30%): 0≤n≤10000\le n\le 1000.

  • Subtask 3 (50%): 0≤n≤1000000\le n\le 100000.

Examples

Example 1

Input:

7

Output:

22

Explanation:

Sum 1 through 7, excluding multiples of 6, obtaining 22.

Example 2

Input:

0

Output:

0

Explanation:

Sum 1 through 0, excluding multiples of 6, obtaining 0.