Given a floating point number X, the form is X = 0.a1a2…an(b1b2…bm) (1≤n,m≤8). (b1b2…bm) indicates the repetend. For example, 0.5 = 0.50 = 0.5(0) = 0.5(00) = 1/2, 0.3(3) = 0.333(33) = 1/3.
Please change the floating point number X into a fraction A / B ( gcd(A, B) = 1 ).
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
the first line contains two integers n, m(1≤n,m≤8).
The following line contains n numbers a1a2…an.
The following line contains m numbers b1b2…bm.
For each test case, output the fraction A / B(0<A,B) on a single line.