#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  int i, m, n, g, a[10000], b[10000];
  cin >> n >> m;
  i = 0;
  int p, q;
  p = n + 1;
  q = m + 1;
  while (p--) {
    cin >> a[i];
    i++;
  }
  i = 0;
  while (q--) {
    cin >> b[i];
    i++;
  }
  if (n > m) {
    if (a[0] * b[0] > 0)
      cout << "Infinity";
    else
      cout << "-Infinity";
  } else if (n < m)
    cout << "0/1";
  else {
    (a[0] > b[0]) ? (p = a[0], q = b[0]) : (p = b[0], q = a[0]);
    if (p < 0) p = p * -1;
    if (q < 0) q = q * -1;
    g = gcd(q, p);
    a[0] = a[0] / g;
    b[0] = b[0] / g;
    if (b[0] < 0 && a[0] > 0 || (a[0] < 0 && b[0] < 0)) {
      a[0] = -1 * a[0];
      b[0] = -1 * b[0];
    }
    cout << a[0] << "/" << b[0];
  }
  return 0;
}
