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