#include <bits/stdc++.h>
long gcd(long a, long b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  long a[105], b[105], i, j, k, l, m, n, x, y;
  while (scanf("%ld%ld", &k, &l) == 2) {
    for (i = 0; i <= k; i++) scanf("%ld", &a[i]);
    for (i = 0; i <= l; i++) scanf("%ld", &b[i]);
    if (k == l) {
      x = gcd(a[0], b[0]);
      m = a[0] / x;
      n = b[0] / x;
      if (n < 0) {
        n = -n;
        m = -m;
      }
      printf("%ld/%ld\n", m, n);
    } else if (k < l) {
      printf("0/1\n");
    } else {
      if ((a[0] > 0 && b[0] > 0) || (a[0] < 0 && b[0] < 0))
        printf("Infinity\n");
      else
        printf("-Infinity\n");
    }
  }
  return 0;
}
