It was a wonderful night participating in the WahYan High Table Dinner 2025. The Wah Yan High Table Dinner is a prestigious event that brings together esteemed guests from various participating schools, fostering an enriching environment for the Wah Yan community. This gathering provides attendees with the opportunity to exchange ideas, share experiences, and engage in meaningful discussions. WYHTD aims to help participants expand their social networks while gaining valuable insights for personal and academic growth. By connecting with peers and distinguished guests, students can explore new perspectives and opportunities.


(Source from wyhk_wyhs)

As one of the organizing committees of the WYHTD2025. CL and his committees would like to wrap up the night before cleaning up the venue. The game is called "Stack the Plates".

Given that there are $N$ rectangle shaped plates on the table, where the $i$-th plate has the length of $L_i$ and width of $W_i$. The committees will try to stack them up (You may ignore the thickness of the plates, they are very very thin). The $1$-st plate will be placed on the table initially, and the following $N-1$ plates are placed one by one such that all top left corners of plates are on the same point. After the game, CL wants to know what is the area of table that is covered by at least one plate. Since he is busy cleaning up the mess, he asks you to tell him the answer.

Input

The first line consists of 1 integer $N$.
The following $N$ lines contains 2 integers, where the $i$-th line contains $L_i$, $W_i$.

Output

Output consists of only 1 integer, the total area covered by at least one plate.

Constraints

For all cases, $1 \le N \le 10, 1 \le L_i, W_i \le 100$
Subtask 1 (20%): $N = 1$
Subtask 2 (80%): No additional constraints

Sample Test Cases

Input Output
2
2 2
1 3
5
The table after putting the first plate:

The table after putting the second plate:
Click to copy.

Scoring: Per Subtask
Authored by wy23493
Appeared in WYHK 2025 Mini Contest 1 [Session 2] and WYHK 2025 Mini Contest 1