Binary grid indicates to a grid that contains only 0s and 1s in its cells. You can find a plus(+) symbol in a binary grid.
Following grid contains a plus(+) symbol.
You can form a plus symbol by choosing some cells from a grid if the chosen cells satisfy all of the following conditions:
Weight of a plus symbol means the distance between the center and furthest cell containing 1. Weight of the above plus(+) symbol is 1. Whenever you make a plus(+) symbol, your objective is to maximize its weight. Same cell can be part of multiple plus symbol.
Following grid contains a plus symbol of weight 2.
Score of a grid is the sum of weight of all plus symbols in it.
Score of the following grid is 3 (weight of plus symbol centered in (3, 3) cell is 2 and weight of plus symbol centered in (6, 3) cell is 1)
Bob has received a binary grid from his friend as a birthday gift. But he has lost the data of this grid. He has become sad, because he didn’t calculate the score of his grid. Only thing he can remember is the length and width of the grid. So he is interested in knowing the expected score of the grid if it is filled up randomly. You have a good friendship with Bob. So you want to help Bob by calculating the expected score of his grid.
You will be given the length and width of a binary grid. Your task is to calculate the expected score of the grid if it is filled up randomly. Assume that 0s and 1s are distributed in the grid with equal probability.
First line contains an integer (), denotes the number of test cases. Then line follows, Each line contains two integers and (, ), denotes the length and width of the grid respectively.
For each case, output the case number and the expected score in a single line.
If the answer is , then print it as .
Here, is an integer greater than or equal to 0, is an integer greater than 0.
1 3 3
Case 1: 142578126