Tim, the time-traveling salesman, makes the future his first stop. When he arrives he meets many different sentient aliens, each with a different number of fingers, and he notices all kinds of strange currencies changing hands. Counterfeiting is such a serious problem in the future that the intergalactic government has gone overboard minting new kinds of currency. Because its members have widely varying numbers of fingers and everyone is excellent at math, the new currencies use very confusing denominations. Instead of a Melka being worth 10 Zedars and a Zedar being worth 10 Milbacs, a Melka is worth 13 Zedars and a Zedar is worth 41 Milbacs (the alien race called the Stalsgeap are famous for their 41-fingered hands).
Keeping all of these currencies straight will be hard, but one thing Tim knows for sure is to buy low and sell high. Given the currency denominations and several vendors' prices for a single item — each price expressed as the number of notes of every denomination — find the difference between the lowest price Tim can buy the item for and the highest price he can sell it for.
The first line contains the number of data sets $K$, followed by the $K$ data sets. Each data set has the following form.
The first line of a data set contains the number of denominations $2 \le D \le 7$ and the number of prices $2 \le N \le 10$. Denominations are numbered from the largest ($1$) to the smallest ($D$). The next line contains $D - 1$ positive integers; the $i$-th integer is how many notes of denomination $i + 1$ are worth one note of denomination $i$.
Then follow $N$ lines, each describing one price. Each such line contains $D$ non-negative integers, where the $i$-th integer is the number of notes of denomination $i$ in that price. Every price, once expressed in the smallest denomination, is guaranteed to fit in a 32-bit integer.
For each data set, output "Data Set x:" on its own line, where $x$ is the number of the data set. On the next line, output the difference between the highest price and the lowest price, expressed in the smallest denomination. Separate consecutive data sets with a blank line.