Problems
Horrible Queries
Horrible Queries
World is getting more evil and it's getting tougher to get into the Evil League of Evil. Since the legendary Bad Horse has retired, now you have to correctly answer the evil questions of Dr. Horrible, who has a PhD in horribleness (but not in Computer Science). You are given an array of $n$ elements, which are initially all $0$. After that you will be given $c$ commands. They are:
\begin{itemize}
\item $0~p~q~v$ --- you have to add $v$ to all numbers in the range of $p$ to $q$ inclusive, where $p$ and $q$ are two indexes of the array.
\item $1~p~q$ --- print a line containing a single integer which is the sum of all the array elements between $p$ and $q$ inclusive.
\end{itemize}
\InputFile
The first line contains the number of test cases. Each test case starts with $n~(n \le 10^5)$ and $c~(c \le 10^5)$. After that you'll be given $c$ commands in the format as mentioned above. It is known that $1 \le p, q \le n$ and $1 \le v \le 10^7$.
\OutputFile
Print the answers to the queries.
Input example #1
1 8 6 0 2 4 26 0 4 8 80 0 4 5 20 1 8 8 0 5 7 14 1 4 8
Output example #1
80 508