TV War

No attempts yetTime limit1sMemory limit256 MB

Problem

There is only one television in the house, so the family argues every time about which program to watch. You are building a machine that settles the argument automatically.

The programs the family wants to watch during the year are already fixed. Every program starts at the same time each week and ends at the same time each week, so one weekly viewing plan is enough to cover the whole year. Each program has a preference score given by the family, and a higher score means the family wants to watch that program more. Because there is only one television, two programs whose times overlap cannot both be watched.

Choose programs whose viewing times do not overlap so that the total preference is as large as possible, and report that maximum.

Input

The first line contains the number of test cases tt.

The first line of each test case contains the number of programs nn (1n100000)(1 \le n \le 100000). Each of the next nn lines contains three integers ss, dd, pp separated by spaces. ss is the time the program starts, dd is how long the program lasts, and pp is its preference score. (0s<s+d10080, 1p2000)(0 \le s < s+d \le 10080,\ 1 \le p \le 2000)

If s+ds+d equals kk, the program ends exactly at time kk, and another program can be watched starting exactly at time kk.

Output

For each test case, print the maximum total preference on its own line.

Hint

In the first example, taking the program that starts at time 11 and lasts 44 together with the program that starts at time 66 and lasts 44 gives a total preference of 6+5=116+5=11, which is the largest the family can reach.