#include <bits/stdc++.h>
using namespace std;
vector<int> primefac;
vector<int> d;
vector<int> adj[200030];
vector<int> dist;
bool nod[200030];
int ceildiv(int one, int two) {
  if (one % two == 0) {
    return one / two;
  } else {
    return one / two + 1;
  }
}
void primeFactors(int n) {
  primefac.clear();
  while (n % 2 == 0) {
    primefac.push_back(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      primefac.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) {
    primefac.push_back(n);
  }
}
int power(int n, int pow, int m) {
  if (pow == 0) return 1;
  if (pow % 2 == 0) {
    long long x = power(n, pow / 2, m);
    return (x * x) % m;
  } else
    return (power(n, pow - 1, m) * n) % m;
}
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
bool permutation(int arr[], int n) {
  set<int> hash;
  int maxEle = 0;
  for (int i = 0; i < n; i++) {
    hash.insert(arr[i]);
    maxEle = max(maxEle, arr[i]);
  }
  if (maxEle != n) {
    return false;
  }
  if (hash.size() * 1LL == n) {
    return true;
  }
  return false;
}
void divis(int n) {
  d.clear();
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      d.push_back(i);
      if (i * i != n) {
        d.push_back(n / i);
      }
    }
  }
  sort(d.begin(), d.end());
}
int factorial(int n, int mod) {
  if (n > 1)
    return (n * factorial(n - 1, mod)) % mod;
  else
    return 1;
}
int lcm(int a, int b) { return (a * b) / gcd(a, b); }
bool checkPrimeNumber(int n) {
  if (n <= 3) {
    return true;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    return false;
  }
  for (long long i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return string(s); }
string to_string(string s) { return s; }
string to_string(vector<bool> v) {
  string res;
  for (int i = 0; i < (int)v.size(); i++) res += char('0' + v[i]);
  return res;
}
template <class T>
string to_string(T v) {
  bool f = 1;
  string res;
  for (auto x : v) {
    if (!f) res += ' ';
    f = 0;
    res += to_string(x);
  }
  return res;
}
template <class A>
void write(A x) {
  cout << to_string(x);
}
template <class H, class... T>
void write(const H& h, const T&... t) {
  write(h);
  write(t...);
}
void print() { write("\n"); }
template <class H, class... T>
void print(const H& h, const T&... t) {
  write(h);
  if (sizeof...(t)) write(' ');
  print(t...);
}
void dfs(int u) {
  nod[u] = true;
  for (auto x : adj[u]) {
    if (nod[x]) continue;
    nod[x] = true;
    dfs(x);
  }
}
void bfs(int s) {
  dist.assign(200005, -1);
  queue<int> q;
  dist[s] = 0;
  q.push(s);
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int v : adj[u]) {
      if (dist[v] == -1) {
        dist[v] = dist[u] + 1;
        q.push(v);
      }
    }
  }
}
template <class T>
class SegmentTree {
 public:
  T N, sz;
  vector<T> tree;
  SegmentTree(T n) {
    N = n;
    sz = 4 * N;
    tree.resize(sz, 0);
  }
  SegmentTree(vector<T>& a) {
    N = a.size();
    sz = 4 * N;
    tree.resize(sz, 0);
    build(0, 0, N - 1, a);
  }
  T merge(T x, T y) { return x + y; }
  void build(int v, int l, int r, vector<T>& a) {
    if (l == r) {
      tree[v] = a[l];
      return;
    }
    int m = l + (r - l) / 2;
    build(2 * v + 1, l, m, a);
    build(2 * v + 2, m + 1, r, a);
    tree[v] = merge(tree[2 * v + 1], tree[2 * v + 2]);
  }
  void update(int v, int l, int r, int p, T val) {
    if (p < l || p > r) return;
    if (l == r) {
      tree[v] = val;
      return;
    }
    int m = l + (r - l) / 2;
    update(2 * v + 1, l, m, p, val);
    update(2 * v + 2, m + 1, r, p, val);
    tree[v] = merge(tree[2 * v + 1], tree[2 * v + 2]);
  }
  T query(int v, int l, int r, int ql, int qr) {
    if (qr < l || ql > r) return 0;
    if (ql <= l && r <= qr) return tree[v];
    int m = l + (r - l) / 2;
    return merge(query(2 * v + 1, l, m, ql, qr),
                 query(2 * v + 2, m + 1, r, ql, qr));
  }
  T get(int l, int r) { return query(0, 0, N - 1, l, r); }
  void modify(int pos, T val) { update(0, 0, N - 1, pos, val); }
};
void solve() {
  int n, m;
  cin >> n >> m;
  int a[n + 1], b[m + 1];
  for (int i = 0; i < n + 1; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m + 1; i++) {
    cin >> b[i];
  }
  if (m > n) {
    cout << "0/1" << '\n';
    return;
  }
  if (n != m) {
    if (a[0] < 0 && b[0] < 0) {
      cout << "Infinity" << '\n';
      return;
    }
    if (a[0] > 0 && b[0] > 0) {
      cout << "Infinity" << '\n';
      return;
    }
    cout << "-Infinity" << '\n';
    return;
  }
  if (n == m) {
    int d = gcd(abs(a[0]), abs(b[0]));
    if ((a[0] < 0 && b[0] < 0) || (a[0] > 0 && b[0] > 0)) {
      cout << abs(a[0] / d) << "/" << abs(b[0] / d) << '\n';
      return;
    }
    cout << "-" << abs(a[0] / d) << "/" << abs(b[0] / d) << '\n';
    return;
  }
}
int32_t main() { solve(); }
