#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a, b, temp, i;
  cin >> a;
  for (i = 0; i < n; i++) {
    cin >> temp;
  }
  cin >> b;
  for (i = 0; i < m; i++) {
    cin >> temp;
  }
  if (m > n) {
    cout << "0/1";
  } else if (n > m && a * b > 0) {
    cout << "Infinity";
  } else if (n > m) {
    cout << "-Infinity";
  } else {
    for (int i = min(abs(a), abs(b)); i > 1; i--) {
      if (abs(a) % i == 0 && abs(b) % i == 0) {
        a /= i;
        b /= i;
      }
    }
    if (a * b < 0) {
      cout << "-";
    }
    cout << abs(a) << "/" << abs(b);
  }
  return 0;
}
