## Magical Bribery

View as PDF

Points: 7
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type

Anish has been having trouble in computer science, and is trying to bribe Mr. McKenzie to raise his mark. Now, since bribing Mr. Mckenzie with money obviously won’t work, Anish is going to use magic cards. Mr. Mckenzie places value on a certain amount of magic cards, for example 3 cards might have a value of 5, then 4 cards have a value of 6, and 6 cards could have a value of 12. Given how many cards Anish has, and how much Mr. Mckenzie values every amount of cards, print out the maximum value Anish can get for his cards.

#### Input Specifications

A number for how many cards Anish has, and on the next lines, a number which represents how much Mr. Mckenzie values a package of cards.

#### Output Specifications

The maximum value Anish can get for his cards.

#### Sample Input

8
6
15
18
22
25
51
51
59

#### Sample Output

66