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