5.5 Opportunities
(RankList for this Question)
Score: 50pts
Time Limit: 1.00 sec
In a world filled with exciting project opportunities, you find yourself faced with a choice. There are n projects waiting for your attention, each project specifying its start and end dates along with a tantalizing monetary reward. However, there's a catch: you can only dedicate yourself to a single project each day.

Imagine this scenario as a calendar of possibilities, where every project offers a unique chance to earn a reward. Your goal is to devise a strategic plan to maximize your earnings. It's like creating a personal schedule of wealth where you aim to pocket the most money possible.

Each day presents a new puzzle, where you must decide which project to undertake, considering its start and end dates and the corresponding reward. Sometimes, you might find projects that overlap, requiring careful consideration of trade-offs. Other times, you'll face days with multiple project options, challenging your decision-making skills.

In this exciting journey of project selection, you'll need to be a master of strategy, selecting projects that offer the highest rewards while fitting within your daily constraints. Your ultimate aim? To craft a schedule that leads to the maximum possible amount of money earned by the end of your adventure. It's a story of financial prowess and strategic planning in the quest for the most lucrative path through the world of projects.

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

Input Format
The first input line contains an integer n: the number of projects.
After this, there are n lines. Each such line has three integers ai, bi, and pi: the starting day, the ending day, and the reward.

Output Format



Example 1
2 4 4
3 6 6
6 8 2
5 7 3


This Example is self explanatory

Log In to solve the Question