#include <iostream>
(30316)#include <vector>
#include <algorithm>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int a, b, c, d, k;
cin >> a >> b >> c >> d >> k;
vector<int> numbers = {a, b, c, d};
// 进行k次操作
for (int i = 0; i < k; ++i) {
// 找到列表中的最小数
auto min_iter = min_element(numbers.begin(), numbers.end());
// 将最小数加1
*min_iter += 1;
}
// 计算乘积
int product = 1;
for (int num : numbers) {
product *= num;
}
cout << product << endl;
}
return 0;
}