The Frobenius problem is an old problem in mathematics, named after the German mathematician G. Frobenius (1849-1917).
Let a1,a2,…,an be integers larger than 1 whose greatest common divisor is 1. It is known that only finitely many integers greater than or equal to 0 cannot be written as w1a1+w2a2+⋯+wnan with integer coefficients wi≥0. The largest such integer is the Frobenius number of a1,a2,…,an, written F(a1,a2,…,an). So F(a1,a2,…,an) is the largest nonnegative integer that is not a nonnegative integer linear combination of a1,a2,…,an.
For n=2 there is a simple formula for F(a1,a2). For n≥3 it is much more complicated. When n=3, formulas are known only for special choices of a1,a2,a3, and for n>4 no formula is known at all.
This problem asks about the case n=4. Four integers a,b,c,d are given with a,b,c,d>1 and gcd(a,b,c,d)=1. Two things are asked.
The first line contains the number of test cases. Each test case has the following format.
Print two lines for every test case.