#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b > a) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, m, val1, val2, v1, v2, x, y, g, i, sign1, sign2;
  cin >> n >> m;
  cin >> val1;
  for (i = 0; i < n; i++) cin >> v1;
  cin >> val2;
  for (i = 0; i < m; i++) cin >> v2;
  if (val1 > 0) {
    sign1 = 1;
  } else {
    sign1 = -1;
    val1 = (-1) * val1;
  }
  if (val2 > 0) {
    sign2 = 1;
  } else {
    sign2 = -1;
    val2 = (-1) * val2;
  }
  if (n > m) {
    if (sign1 * sign2 > 0)
      cout << "Infinity" << endl;
    else
      cout << "-Infinity" << endl;
  } else if (n < m) {
    cout << "0/1" << endl;
  } else {
    g = gcd(val1, val2);
    x = val1 / g;
    y = val2 / g;
    if (sign1 * sign2 < 0) cout << "-";
    printf("%d/%d\n", x, y);
  }
  return 0;
}
