#Lutece1069. 秋实大哥去打工

秋实大哥去打工

Migrated from Lutece 1069 秋实大哥去打工

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

天行健,君子以自强不息。地势坤,君子以厚德载物。

天天过节的秋实大哥又要过节了,于是他要给心爱的妹子买礼物。但由于最近秋实大哥手头拮据,身为一个男人,他决定去打工!

秋实大哥来到一家广告公司。现在有nn块矩形墙从左至右紧密排列,每一块高为HiH_i,宽为WiW_i

公司要求秋实大哥找出一块最大的连续矩形区域,使得公司可以在上面贴出最大的海报。

Input

第一行包含一个整数nn,表示矩形墙的个数。

接下来nn行,每行有两个整数WiW_iHiH_i,表示第ii块墙的宽度和高度。

1n2000001\leq n\leq 200000,保证WiW_iHiH_i以及最后的答案<231< 2^{31}

Output

最大的连续矩形的面积。

Samples

3
3 4
1 2
3 4
14

Resources

2015 UESTC Training for Data Structures