Leo is back to work. After winning the Oscar Leo has decided to choose his next movies such that he gets maximum pay. Since Leo is a dedicated actor he does only one movie at a time. He can start a new movie the same month he ends a movie.Leo's agent gives him a list of movies each having three parameters start S denoting the starting month of the movie,end E denoting the ending month of the movie and finally pay P denoting the money he will be paid for that movie.Now, Leo is confused and asks for your help to choose for him those movies that will get him the maximum pay. Help Leo as we all love him.
Subtask 1: 40 points
Subtask 2: 60 points
Input: 1 5 1 3 50 2 4 20 4 6 40 3 5 60 7 9 100 Output: 210
Explanation:
Leo can work in movies 1 , 4 and 5 so that his pay = 50 + 60 + 100 = 210