eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач

Region

Лимит времени 1 секунда
Лимит использования памяти 64 MiB

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?

Входные данные

The first line contains a single integer T, indicating the number of test cases. Each test case begins with two integers N (0N1000) and M (0M1000), indicating the number of lines and circles respectively.

Выходные данные

For each case, output one integer, indicating the maximum regions.

Пример

Входные данные #1
4
1 1
1 2
2 1
2 2
Выходные данные #1
4
8
8
14
Источник 2010 Wuhan University 4th "Eming" Cup Programming Contest