Ontongdaejeon

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

You have to buy NN items to prepare RUN Spring Contest.

In Daejeon, there is a famous local currency, Ontongdaejeon.

Using Ontongdaejeon, you can get a cashback point when purchasing an item - precisely 10 percent of the cash you have paid as a cashback point.

If you have already got some cashback point from the previous purchases, you can use it instead of any non-negative integer amount of cash you want.

 Specifically, you can use the cashback point with the following steps:

  1. Let cc be the amount of cashback point you already have and pp be the price of an item you want to purchase.

  2. You should determine the amount of cashback point to use. Let this be xx.

  3. xx should satisfy following conditions:

    • xpx \le p
    • xcx \le c
    • xx must be an non-negative integer.
  4. Then, you can use xx cashback points and pxp-x cash to buy the item.

  5. After buying the item, the cashback point you would have is (cx)+px10(c-x) + \dfrac{p-x}{10}.

Find the minimum amount of cash required to buy NN items in a given order.

Before buying the first item, you have no cashback points.

입력

The first line contains one integer NN, where NN denotes the number of items.

The second line contains NN space-separated integers P_1.P_2,...,P_NP\_1. P\_2, ..., P\_N where P_iP\_i denotes the price of ii-th item.

출력

Find the minimum amount of cash required to buy all NN items in a given order using Ontongdaejeon.

제한

  • 1N200,0001 \le N \le 200\\,000
  • 1P_i1091 \le P\_i \le 10^9 (1iN)(1 \le i \le N)