#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int a[110];
  int b[110];
  cin >> n >> m;
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= m; i++) {
    cin >> b[i];
  }
  if (n == m) {
    int x, y;
    x = a[0];
    y = b[0];
    if (x < y) {
      swap(x, y);
    }
    while (y) {
      x %= y;
      swap(x, y);
    }
    a[0] = a[0] / x;
    b[0] = b[0] / x;
    if ((a[0] < 0 && b[0] < 0) || (a[0] > 0 && b[0] > 0)) {
      cout << abs(a[0]) << "/" << abs(b[0]);
    } else {
      cout << "-" << abs(a[0]) << "/" << abs(b[0]);
    }
  } else {
    if (m > n) {
      cout << "0/1" << endl;
    } else {
      if (m == 0) {
        if (a[0] < 0) {
          cout << "-Infinity" << endl;
        } else {
          cout << "Infinity" << endl;
        }
        return 0;
      }
      if ((b[0] < 0 && a[0] > 0) || (b[0] > 0 && a[0] < 0)) {
        cout << "-Infinity" << endl;
      } else {
        cout << "Infinity" << endl;
      }
    }
  }
  return 0;
}
