//Why I can't submit? //fdsjkevhkjvhshfkjdsvc #include #include #include using namespace std; #define M 1005 int T, n, f[M], g[M], Maxffff, Maxgggg; int Get_gcd (int a, int b){ if (! b) return a; return Get_gcd (b, a % b); } int main (){ scanf ("%d", &T); while (T --){ Maxffff = Maxgggg = 0; scanf ("%d", &n); for (int i = 1; i <= n; i ++){ scanf ("%d", &f[i]); if (f[i]) Maxffff = max (Maxffff, i); } for (int i = 1; i <= n; i ++){ scanf ("%d", &g[i]); if (g[i]) Maxgggg = max (Maxgggg, i); } if (Maxffff > Maxgggg) printf ("1/0\n"); else if (Maxffff < Maxgggg) printf ("0/1\n"); else{ int GCD = Get_gcd (f[Maxffff], g[Maxgggg]); printf ("%d/%d\n", f[Maxffff] / GCD, g[Maxgggg] / GCD); } } return 0; }