Time

10:11:23
11 Feb 2012
ACM-ICPC Thailand Southern Region Programming Contest 2011
Left: 4 hours 49 minutes
End: 11.02.2012 15:00
Leader: Informatimukas
Five for week 22
Left: 11 hours 49 minutes
End: 11.02.2012 22:00
Leader: NuM
Version for print

The vouchers

   The tour operator did not sell n (n < 15) vouchers to mountain-ski resort because of the great frost. The terms of vouchers validity is already come. To reduce the losses, it was decided from the February 1, that all the vouchers for which remained dk (dk30) days, to sell for minimal cost – for ñk (ñk100) UAH for a day only for that days, which remained from the sale day (k = 1..n).

   What is the largest amount of income can get the travel company selling these vouchers, if one voucher can be sold only in one day?


Specifications

   Input

   The first line contains the number of vouchers n. Each of the next n lines contains two numbers - the number of days dk left and the cost of each day ck.

   Output

   The maximum amount of income.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 40% 123/206
Classes: Full Search

Example

Example input

4
2 37
3 45
1 46
4 30

Example output

232


← Two factors Problems Roman numerals →