eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків

Region

In geometry, lines and circles are both very charming shapes, with a lot of interesting properties. We know a line divides the plane into two regions, so does a circle. But how many regions N lines and M circles can divide at most? \InputFile The first line contains a single integer \textbf{T}, indicating the number of test cases. Each test case begins with two integers \textbf{N }(\textbf{0} ≤ \textbf{N} ≤ \textbf{1000}) and \textbf{M} (\textbf{0} ≤ \textbf{M} ≤ \textbf{1000}), indicating the number of lines and circles respectively. \OutputFile For each case, output one integer, indicating the maximum regions.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
4
1 1
1 2
2 1
2 2
Вихідні дані #1
4
8
8
14
Джерело 2010 Wuhan University 4th "Eming" Cup Programming Contest