Ontongdaejeon
면접 대비시간 제한1초메모리 제한1024 MB
N개의 물건을 순서대로 사면서 각 물건에 쓸 캐시백 포인트를 정해 지불한 현금 총액을 최소로 만든다.
문제
You have to buy 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:
-
Let be the amount of cashback point you already have and be the price of an item you want to purchase.
-
You should determine the amount of cashback point to use. Let this be .
-
should satisfy following conditions:
- must be an non-negative integer.
-
Then, you can use cashback points and cash to buy the item.
-
After buying the item, the cashback point you would have is .
Find the minimum amount of cash required to buy items in a given order.
Before buying the first item, you have no cashback points.
입력
The first line contains one integer , where denotes the number of items.
The second line contains space-separated integers where denotes the price of -th item.
출력
Find the minimum amount of cash required to buy all items in a given order using Ontongdaejeon.