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