#include <bits/stdc++.h>
using namespace std;
int a[105], b[105];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, m, i, j;
  while (cin >> n >> m) {
    for (i = 0; i <= n; i++) cin >> a[i];
    for (i = 0; i <= m; i++) cin >> b[i];
    if (a[0] * b[0] > 0) {
      if (n > m)
        printf("Infinity\n");
      else if (n < m)
        printf("0/1\n");
      else {
        int x = abs(a[0]);
        int y = abs(b[0]);
        int p = gcd(x, y);
        printf("%d/%d\n", x / p, y / p);
      }
    } else {
      if (n > m)
        printf("-Infinity\n");
      else if (n < m)
        printf("0/1\n");
      else {
        int x = abs(a[0]);
        int y = abs(b[0]);
        int p = gcd(x, y);
        printf("-%d/%d\n", x / p, y / p);
      }
    }
  }
  return 0;
}
