#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e2 + 42;
int n, m, x, p, q;
int eu(int a, int b) {
  if (a % b == 0) return b;
  return eu(b, a % b);
}
int sign(int y) {
  if (y > 0) return 0;
  return 1;
}
int main() {
  cin >> n >> m >> p;
  for (int i = 1; i <= n; i++) cin >> x;
  cin >> q;
  for (int i = 1; i <= m; i++) cin >> x;
  int sign1 = sign(p), sign2 = sign(q);
  p = abs(p);
  q = abs(q);
  if (n < m) {
    cout << "0/1" << endl;
    return 0;
  }
  if (n == m) {
    int g = eu(p, q);
    p = p / g;
    q = q / g;
    if ((sign1 + sign2) % 2 == 1) cout << '-';
    cout << p << "/" << q << endl;
    return 0;
  }
  if (n > m) {
    if ((sign1 + sign2) % 2 == 1) cout << '-';
    cout << "Infinity" << endl;
    return 0;
  }
  return 0;
}
