Company: User Submitted_24july
Difficulty: medium
An analyst on a financial team is studying an unbounded row of bags. The bags are numbered 1, 2, 3, … and, in principle, the row continues forever. Every bag holds some amount of money, and the analyst wants to pick a block of exactly k consecutive bags whose total money is as large as possible. The amounts of money are described by a collection of n segments . Each segment is a triple [L, R, V] , meaning that every bag whose number lies in the inclusive range L … R contains exactly V units of money. The segments are pairwise non-overlapping , so no bag is described by more than one segment. Any bag that is not covered by any segment contains 0 money. Among all possible blocks of k consecutive bags (a block may start at any bag number ≥ 1 and may extend over bags that hold no money), find the maximum possible total amount of money contained in one block. Because this total can be very large, print it modulo 1000000007 (that is, 10^9 + 7 ). Input Format The first line contains a single