There are N People, i-th person wants to be friend with all the person between [Xi,Yi].
A friendship is possible between two distinct person if and only if both of them wants to be friends with each other i.e, i-th and j-th person can be friend only if Xi ≤ j ≤ Yi and Xj ≤ i ≤ Yj.
Print the total number of possible friendship.
Input format
Output format
For each test case print the total number of possible friendship in a separate line.
Constraints
1≤T≤1000
1≤N≤105
1≤Xi≤Yi≤N
The sum of N over all test cases does not exceed 2⋅105
Friendship is only possible between (1,2), (1,4) and (3,6).