inet.in
inet.out
Peter is working on a project. To do his job, Peter needs permanent access to the Internet in the time interval B ≤ t ≤ E (1 ≤ B < E ≤ 109). To have the access, Peter has to buy service cards from his local Internet Service Provider. There are N types of service chards (1 ≤ N ≤ 105). The service card of type #i costs Si (1 ≤ Si ≤ 20 000) and allows connecting to the Internet from Bi till Ei (1 ≤ Bi < Ei ≤ 109). It's guaranteed than for any t0 (B ≤ t0 ≤ E), there is at least one service card #i such that Bi ≤ t0 ≤ Ei.
Your task is to calculate the minimal total cost of a set of service cards that would permit Peter having permanent access to Internet.
The first line of the input text file contains the value of N, the second one - values B and E. Each of the following N lines describes one service card type and consists of values Bi, Ei, Si. All numbers in the input file are integers and are separated by single spaces.
The single line of the output text file should contain the total cost of service cards that Peter should buy to have permanent access to the Internet.
7 10 30 9 14 10 13 19 18 14 18 16 18 24 14 24 30 9 17 2005 24 15 20 14
49