eolymp
bolt
Try our new interface for solving problems
Problems

Competitive Programmers

Competitive Programmers

This year competitive programming became popular in KBTU and Mr.Yerzhan opened competitive programming club. There are $n$ students in this club. According to Mr.Yerzhan's theory the two most important skills in competitive programming are coding and math skills. After several contests he assessed both skills of each student. Thus, now the $i$-th student's coding skill can be represented as a positive integer $c_i$ and math skill as a positive integer $m_i$. The hardest thing for Mr.Yerzhan is to find coaches for these students. To be able to teach a student, a coach needs to have both coding and math skills at least as the student's ones. Luckily he can find coaches with arbitrary skills. Mr.Yerzhan is going to hire several coaches. He wants to hire them in such a way that for each student there will be a coach who is able to teach him. Each coach may teach any number of students. Mr.Yerzhan's only concern is a total salary of coaches. A coach with coding skill $c$ and math skill $m$ will be paid $c * m$ tenge a month. You have to write a program which will find minimum total salary of coaches. \InputFile The first line contains $n~(1 \le n \le 10^5)$ -- the number of students in the club. Each of the next $n$ lines contains two integers $c_i$ and $m_i$ $(1 \le c_i, m_i \le 10^6)$ -- coding and math skills of $i$-th student. \OutputFile Print one integer -- the minimum total salary of coaches. \Example In the given example the optimal way is to hire two coaches with skills $(2,6)$ and $(4,2)$. So, the total salary is $2 * 6 + 4 * 2 = 20$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
4
1 6
4 2
2 2
2 5
Output example #1
20