You are given $$$t$$$ test cases. Each test case is a sequence of five non-negative integers. Your goal is to reduce all five numbers to zero by applying a sequence of operations at minimum total cost.
There are two types of operations:
For each test case, determine the minimum total cost required to reduce all five integers to zero. If it is impossible, output $$$-1$$$.
The first line contains $$$t$$$ ($$$1 \leq t \leq 10^6$$$), the number of test cases. The only line of each test case includes $$$5$$$ integers, the sequence (sum of sequence $$$\le 7 * 10^9$$$).
For each test case, output the minimum cost, or $$$-1$$$ if it is not possible.
31 1 2 2 11 1 2 1 11 0 0 0 0
3 2 -1
Problem Idea: Nyctivoe
Problem Preparation: Nyctivoe
Occurrences: Novice F