#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (0 == b) return a;
  return gcd(b, a % b);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> a, b;
  for (int i = 0; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a.push_back(x);
  }
  for (int i = 0; i <= m; i++) {
    int x;
    scanf("%d", &x);
    b.push_back(x);
  }
  if (n < m) {
    puts("0/1");
  } else if (n > m) {
    if (a[0] * b[0] > 0) {
      puts("Infinity");
    } else {
      puts("-Infinity");
    }
  } else {
    if (a[0] * b[0] < 0) {
      putchar('-');
    }
    int aa = abs(a[0]), bb = abs(b[0]);
    int g = gcd(aa, bb);
    printf("%d/%d", aa / g, bb / g);
  }
  return 0;
}
