Book rental
After some time working at the library, you began to notice certain patterns. Namely, book number has an interest value of and to read it you need to spend time. Since you love reading so much, you can only take the next book when you have completely finished reading the previous one. Also, all books are very popular — as soon as a book becomes available, someone else takes it. It is known that book number becomes available at time , and if you don't start reading the book at time , someone else will take it. Tell us the maximum sum of interest values of books that you can read.
Input
The first line contains one integer () — the number of books.
The next lines contain integers , , (, ) — descriptions of the books.
Output
Print one integer — the answer to the problem.
Examples
Scoring
It is guaranteed that solutions that work correctly for will earn at least 50 points.