Discount DashEasy

Discount Dash

Easy+10 XP · +5 Aurabasicsloopsconditionals

Rohan is shopping and wants to make the most of the store's sale. The store offers a special discount: if an item's price is ₹500 or more, it gets a 10% discount. Otherwise, it gets a flat ₹50 discount. Rohan wants to know the total amount he has to pay after all discounts are applied. Help Rohan calculate his final bill!

Input

The first line contains an integer N, the number of items Rohan is buying. The next N lines each contain a single integer, the original price of an item.

Output

Print a single integer, the total amount Rohan has to pay.

Constraints

1 <= N <= 1000. Each item price will be between 1 and 10000.

Time limit 1 s (native code; slower languages get more)Memory 256 MB15 hidden tests

Example 1

Input
3
600
400
500
Output
1340

Item 1 (600) gets 10% off (540). Item 2 (400) gets 50 off (350). Item 3 (500) gets 10% off (450). Total = 540 + 350 + 450 = 1340.

Example 2

Input
2
100
900
Output
860

Item 1 (100) gets 50 off (50). Item 2 (900) gets 10% off (810). Total = 50 + 810 = 860.

Hints