#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int c;
  if (a < b) {
    c = b;
    b = a;
    a = c;
  }
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int main() {
  int a[101], b[101], i, s, n, m, sa, sb;
  while (scanf("%d %d", &n, &m) != EOF) {
    for (i = 0; i <= n; i++) scanf("%d", &a[i]);
    for (i = 0; i <= m; i++) scanf("%d", &b[i]);
    if (n > m) {
      if ((a[0] < 0 && b[0] > 0) || (b[0] < 0 && a[0] > 0))
        printf("-Infinity\n");
      if ((a[0] > 0 && b[0] > 0) || (a[0] < 0 && b[0] < 0))
        printf("Infinity\n");
      if (a[0] == 0) printf("0/1\n");
    }
    if (n < m) printf("0/1\n");
    if (n == m) {
      if (a[0] == 0) printf("0/1\n");
      sa = (int)sqrt(a[0] * a[0] * 1.0);
      sb = (int)sqrt(b[0] * b[0] * 1.0);
      s = gcd(sa, sb);
      if (a[0] * b[0] > 0)
        printf("%d/%d\n", sa / s, sb / s);
      else
        printf("-%d/%d\n", sa / s, sb / s);
    }
  }
  return 0;
}
