Problem:
Score : 200 points

Problem Statement

Let us define the FizzBuzz sequence a_1,a_2,... as follows:

If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}.

If the above does not hold but 3 divides i, a_i=\mbox{Fizz}.

If none of the above holds but 5 divides i, a_i=\mbox{Buzz}.

If none of the above holds, a_i=i.

Find the sum of all numbers among the first N terms of the FizzBuzz sequence.

Constraints

1 \leq N \leq 10^6

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

15

Sample Output 1

60

The first 15 terms of the FizzBuzz sequence are:

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

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

Sample Input 2

1000000

Sample Output 2

266666333332

Watch out for overflow.

Solution in Python (3.8.2) (judge verdict: Wrong Answer)

import numpy as np

#入力
n = int(input())

#3の倍数をFに変更
def multiples_3(matrix):
    #列ベクトルを削除(3列目)
    m_de = np.delete(fizzbuzz_list,2, axis=1)
    #Fの列ベクトルを作成
    f_list = np.zeros(j).reshape(-1, 1)
    #結合
    result = np.concatenate([m_de, f_list], 1)
    return result

#列を計算(繰り上げ)
j = -(-n // 3)

#1からnまでの配列を作成
fizzbuzz_list = np.arange(1,n+1)
#要素数
before_size = fizzbuzz_list.size
#3*n行列に変更
fizzbuzz_list.resize((j,3))

#3の倍数をFに変更
fizzbuzz_list = multiples_3(fizzbuzz_list)

#5の倍数をBに変更
n_b_1 = np.arange(3,j,5)
n_b_2 = np.arange(1,j,5)

fizzbuzz_list[n_b_1,0] = 0
fizzbuzz_list[n_b_2,1] = 0

#15の倍数をFBに変更
n_fb = np.arange(4,j,5)
fizzbuzz_list[n_fb,2] = 0

print(np.sum(fizzbuzz_list))

# np.where(fizzbuzz_list[:,2:3],fizzbuzz_list,"F")