#include <bits/stdc++.h>
int gcd_iterative(int a, int b) {
  int temp;
  while (b != 0) {
    temp = b;
    b = a % b;
    a = temp;
  }
  return a;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int a0;
  scanf("%d", &a0);
  for (int i = 0; i < n; ++i) {
    scanf("%*d");
  }
  int b0;
  scanf("%d", &b0);
  for (int i = 0; i < m; ++i) {
    scanf("%*d");
  }
  if (n > m) {
    if (a0 * b0 > 0) {
      puts("Infinity");
    } else {
      puts("-Infinity");
    }
  } else if (n < m) {
    puts("0/1");
  } else {
    int gcd = gcd_iterative(a0, b0);
    a0 /= gcd;
    b0 /= gcd;
    if (a0 * b0 > 0) {
      printf("%d/%d\n", a0, b0);
    } else if (a0 < 0) {
      printf("-%d/%d\n", -a0, b0);
    } else {
      printf("-%d/%d\n", a0, -b0);
    }
  }
  return 0;
}
