#P1409B. Minimum Product
Minimum Product
No submission language available for this problem.
Description
You are given four integers , , and . Initially, and . You can do the following operation no more than times:
- Choose either or and decrease it by one. However, as a result of this operation, value of cannot become less than , and value of cannot become less than .
Your task is to find the minimum possible product of and () you can achieve by applying the given operation no more than times.
You have to answer independent test cases.
The first line of the input contains one integer () — the number of test cases. Then test cases follow.
The only line of the test case contains five integers , , , and (). Additional constraint on the input: and always holds.
For each test case, print one integer: the minimum possible product of and () you can achieve by applying the given operation no more than times.
Input
The first line of the input contains one integer () — the number of test cases. Then test cases follow.
The only line of the test case contains five integers , , , and (). Additional constraint on the input: and always holds.
Output
For each test case, print one integer: the minimum possible product of and () you can achieve by applying the given operation no more than times.
Samples
Note
In the first test case of the example, you need to decrease three times and obtain .
In the second test case of the example, you need to decrease one time, one time and obtain .
In the sixth test case of the example, you need to decrease five times and obtain .
In the seventh test case of the example, you need to decrease ten times and obtain .