#include #include using namespace std; int a[100010],b[100010]; int gcd(int a,int b) { if (!b) return a; return gcd(b,a%b); } int main() { int cas; scanf("%d",&cas); while (cas--) { int n; scanf("%d",&n); int lasta=n,lastb=n; for (int i=1;i<=n;i++) scanf("%d",&a[i]); for (int i=1;i<=n;i++) scanf("%d",&b[i]); for (int i=n;i;i--) if (a[i]) { lasta=i; break; } for (int i=n;i;i--) { if (b[i]) { lastb=i; break; } } if (lasta>lastb) { puts("1/0"); continue; } if (lasta