Dino and fetters#9640

Dino and fetters

1 second
128 megabytes
Easy

In the dinosaur language, the chocolate eggs drawn above are called fetters. Dino loves to eat fetters — they are a true source of energy for him, and he also collects the toys that come from them.

Today, for the next days, Dino has bought fetters. He has made it a habit to eat one fetter in the morning and one in the evening each day. This helps him maintain his energy at a high level.

Dino bought magical fetters that provide different amounts of energy depending on whether they are eaten in the morning or in the evening. For each fetter, we know the amount of energy it provides if eaten in the morning and if eaten in the evening.

Dino is very clever, and over these days, he plans to eat the fetters in such a way as to maximize the total energy he receives.

Find the maximum total amount of energy that Dino can receive.

Input

The first line contains a single integer (1 \leq n \leq 10^5) — the number of days. Each of the following lines contains two integers s_i and a_i (1 \leq s_i, a_i \leq 10^9), denoting the energy the -th fetter provides if eaten in the morning and in the evening, respectively.

Output

Print the maximum total amount of energy that Dino can receive.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading