Code Submission Evaluation System Login

CSES Problem Set

Projects


Task | Statistics


CSES - Projects

Time limit:1.00 s Memory limit:512 MB

There are $n$ projects that you can attend. For each project, you know its starting and ending days and the amount of money you would get as reward. You can only attend one project during a day.

What is the maximum amount of money you can earn?

Input

The first input line contains an integer $n$: the number of projects.

After this, there are $n$ lines. Each such line has three integers $a_i$, $b_i$, and $p_i$: the starting day, the ending day, and the reward.

Output

Print one integer: the maximum amount of money you can earn.

Constraints
Example

Input:
4
2 4 4
3 6 6
6 8 2
5 7 3


Output:
7