#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n, m;
  cin >> n >> m;
  int a, a1;
  cin >> a;
  for (int i = 1; i <= n; i++) {
    cin >> a1;
  }
  int b, b1;
  cin >> b;
  for (int i = 1; i <= m; i++) {
    cin >> b1;
  }
  if (n > m) {
    if (double((double)a / b) < 0) {
      cout << "-Infinity";
    } else {
      cout << "Infinity";
    }
  } else if (n < m) {
    cout << 0 << "/" << 1;
  } else {
    int k = gcd(a, b);
    if (k < 0) {
      k *= -1;
    }
    if (b < 0) {
      int x = a * -1;
      int c = b * -1;
      cout << x / k << "/" << c / k;
    } else
      cout << (a / k) << "/" << (b / k);
  }
  return 0;
}
