#arc085c. [arc085_c]MUL

[arc085_c]MUL

Problem Statement

We have NN gemstones labeled 11 through NN.

You can perform the following operation any number of times (possibly zero).

  • Select a positive integer xx, and smash all the gems labeled with multiples of xx.

Then, for each ii, if the gem labeled ii remains without getting smashed, you will receive aia_i yen (the currency of Japan). However, aia_i may be negative, in which case you will be charged money.

By optimally performing the operation, how much yen can you earn?

Constraints

  • All input values are integers.
  • 1leqNleq1001 \\leq N \\leq 100
  • aileq109|a_i| \\leq 10^9

Input

Input is given from Standard Input in the following format:

NN a1a_1 a2a_2 ...... aNa_N

Output

Print the maximum amount of money that can be earned.


Sample Input 1

6
1 2 -6 4 5 3

Sample Output 1

12

It is optimal to smash Gem 33 and 66.


Sample Input 2

6
100 -100 -100 -100 100 -100

Sample Output 2

200

Sample Input 3

5
-1 -2 -3 -4 -5

Sample Output 3

0

It is optimal to smash all the gems.


Sample Input 4

2
-1000 100000

Sample Output 4

99000