eolymp
bolt
Try our new interface for solving problems
Problems

Letter of postman Pechkin

Letter of postman Pechkin

\includegraphics{https://static.e-olymp.com/content/ac/ac0d88da5ba01bc972e25c0aecaee0f61d37e439.jpg} \textit{Dear children!} \textit{Watching the dog (Cartoon character) sawn custom chess board, I also decided to give you a puzzle: How many different squares and rectangulars (not counting the square ones) boards could be obtained by the dog from a s non-standard rectangular chessboard of size }\textbf{M}x\textbf{N}\textit{?”} \InputFile In the first line number of postman Pechkin tasks \textbf{K}, in the subsequent rows \textbf{K} of two integers \textbf{M} and \textbf{N} (\textbf{1} ≤ \textbf{K},\textbf{ M},\textbf{ N }≤ \textbf{100}), separated by a space. \OutputFile For each example, given Pechkin, display in a separate line in the desired amount of space at first square, then rectangular boards.
Time limit 0.5 seconds
Memory limit 64 MiB
Input example #1
1
3 2
Output example #1
8 10

Example description: The Dog could get square boards: 6 with the side 1 and two with a side of 2 - total 8, rectangular: 4 boards 2x1, 3 boards 1x2, 2 boards 3x1 and one primary board 3x2 - only 10.

Source Stage III All-Ukrainian Olympiad 2009-2010 Zhitomir