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