Water Main Break

Time limit1sMemory limit128 MB

Problem

A water main can break and leak water for a while before it is repaired. In this problem you are given information about several water main breaks — when each one started, when each one ended, and the rate at which water flowed out — together with a time interval. Your task is to compute the total amount of water wasted during that interval.

Time is measured in whole seconds. A water main break that starts at second si and ends at second fi leaks ri gallons at each of the seconds si, si+1, ..., fi (both endpoints included); it is considered repaired from second fi + 1 onward.

Input

The first line contains the number K of data sets. Each data set has the following form:

  • The first line contains a single integer n (0 ≤ n ≤ 30), the number of water main breaks.
  • The second line contains two integers s and f (0 ≤ s ≤ f ≤ 1000), the start and finish seconds of the interval [s, f] over which the wasted water must be counted.
  • Each of the next n lines describes one water main break with three integers si, fi, ri (0 ≤ si ≤ fi ≤ 1000, 0 ≤ ri ≤ 1000): its start second, its finish second, and its flow rate in gallons per second.

Output

For each data set, first print a line Data Set x:, where x is the data set's number starting from 1. On the next line print the total number of gallons of water wasted during the interval [s, f]; this counts water leaking at each of the seconds s, s+1, ..., f. Separate the output of consecutive data sets with a single blank line.