#include <bits/stdc++.h>
using namespace std;
int dequy(int a, int b) {
  if (a == b)
    return a;
  else {
    if (a > b)
      return (dequy(a - b, b));
    else
      return (dequy(a, b - a));
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[1000], b[1000];
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  for (int j = 0; j <= m; j++) {
    cin >> b[j];
  }
  if (n > m) {
    if (a[0] > 0 && b[0] > 0) {
      cout << "Infinity";
    } else if (a[0] < 0 && b[0] < 0) {
      cout << "Infinity";
    } else {
      cout << "-Infinity";
    }
  } else if (n < m) {
    cout << "0/1";
  } else {
    int t = a[0] / dequy(fabs(a[0]), fabs(b[0]));
    int k = b[0] / dequy(fabs(a[0]), fabs(b[0]));
    if (k < 0) {
      t = -t;
      k = -k;
    }
    cout << t << "/" << k;
  }
}
