#K66312. Expected Sum of Coins
Expected Sum of Coins
Expected Sum of Coins
You are given several test cases. In each test case, you are provided two integers N and M. Each test case represents a scenario where you have N coins. Each coin can have an integer value between 1 and M (inclusive), and every value is equally likely. Your task is to calculate the expected value of the sum of these coins.
The expected value for a single coin is given by the formula:
$$ E_{\text{coin}} = \frac{M+1}{2} $$
Thus, the expected sum for N coins is:
$$ E_{\text{total}} = N \times \frac{M+1}{2} $$
Output the result for each test case formatted to exactly two decimal places.
inputFormat
The first line of input contains a single integer T (T > 2), representing the number of test cases. Each of the following T lines contains two space-separated integers N and M.
outputFormat
For each test case, output the expected sum, printed on a new line. The result must be rounded and formatted to exactly two decimal places.
## sample2
3 5
4 2
9.00
6.00
</p>