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