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