#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  int temp;
  if (x < 0) x = -x;
  if (y < 0) y = -y;
  if (x > y) {
    temp = x;
    x = y;
    y = temp;
  }
  while (y != 0) {
    temp = x % y;
    x = y;
    y = temp;
  }
  return x;
}
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    int ni[1000], mi[1000];
    int nx = 0, mx = 0;
    for (int i = 0; i <= n; i++) {
      scanf("%d", &ni[i]);
      if (ni[0] < 0) nx++;
    }
    for (int j = 0; j <= m; j++) {
      scanf("%d", &mi[j]);
      if (mi[0] < 0) mx++;
    }
    if (n > m) {
      if (ni[0] * mi[0] > 0)
        printf("Infinity\n");
      else
        printf("-Infinity\n");
    }
    if (n < m) {
      printf("0/1\n");
    }
    if (n == m) {
      if (ni[0] * mi[0] > 0) {
        ni[0] = abs(ni[0]);
        mi[0] = abs(mi[0]);
        int s = gcd(ni[0], mi[0]);
        printf("%d/%d\n", ni[0] / s, mi[0] / s);
      } else {
        ni[0] = abs(ni[0]);
        mi[0] = abs(mi[0]);
        int s = gcd(ni[0], mi[0]);
        printf("-%d/%d", ni[0] / s, mi[0] / s);
      }
    }
  }
  return 0;
}
