#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1)
      res = ((res % 1000000007) * (a % 1000000007)) % 1000000007, n--;
    else
      a = ((a % 1000000007) * (a % 1000000007)) % 1000000007, n /= 2;
  }
  return res;
}
long long int nCr(long long int n, long long int r) {
  if (r > n) return 0;
  double res = 1;
  for (long long int i = 1; i <= r; i++) res = (res * (n - r + i)) / i;
  return (long long int)(res + 0.01);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long int n, m, x;
  cin >> n >> m;
  long long int a0;
  cin >> a0;
  for (long long int i = 0; i < n; i++) cin >> x;
  long long int b0;
  cin >> b0;
  for (long long int i = 0; i < m; i++) cin >> x;
  if (n > m) {
    if (a0 * b0 < 0)
      cout << "-Infinity";
    else
      cout << "Infinity";
  } else if (m > n)
    cout << "0/1";
  else {
    long long int g = gcd(abs(a0), abs(b0));
    if (a0 * b0 < 0)
      cout << -(abs(a0) / g) << "/" << abs(b0) / g;
    else
      cout << (abs(a0) / g) << "/" << abs(b0) / g;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    solve();
  }
}
