#K72847. Maximize Rectangles with One Cut

    ID: 33844 Type: Default 1000ms 256MiB

Maximize Rectangles with One Cut

Maximize Rectangles with One Cut

You are given a rectangular sheet of paper with dimensions \(L\) and \(W\) (length and width). With a single straight cut (either horizontal or vertical), you always split the rectangle into 2 smaller rectangles. Your task is to output the maximum number of rectangles that can be achieved with one straight cut for each test case.

Note: Regardless of the dimensions provided, one straight cut will always produce exactly 2 rectangles.

inputFormat

The first line of input contains an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains two space-separated integers \(L\) and \(W\), where \(L\) is the length and \(W\) is the width of the rectangle.

outputFormat

For each test case, output a single integer on a new line, which is the maximum number of rectangles that can be obtained with one straight cut.

## sample
3
4 5
8 8
6 9
2

2 2

</p>