Problem: Warning: This problem has an unusual memory limit!

Bob decided that he will not waste his prime years implementing GUI forms for a large corporation and instead will earn his supper on the Stock Exchange Reykjavik. The Stock Exchange Reykjavik is the only actual stock exchange in the world. The only type of transaction is to take a single share of stock x and exchange it for a single share of stock y, provided that the current price of share x is at least the current price of share y. 

There are 2n stocks listed on the SER that are of interest to Bob, numbered from 1 to 2n. Bob owns a single share of stocks 1 through n and would like to own a single share of each of n+1 through 2n some time in the future.

Bob managed to forecast the price of each stock — in time t ≥ 0, the stock i will cost a_i ⋅ ⌊ t ⌋ + b_i. The time is currently t = 0. Help Bob find the earliest moment in time in which he can own a single share of each of n+1 through 2n, and the minimum number of stock exchanges he has to perform in order to do that.

You may assume that the Stock Exchange has an unlimited amount of each stock at any point in time. 

Input

The first line contains a single integer n (1 ≤ n ≤ 2200) — the number stocks currently owned by Bob.

Each of the next 2n lines contains integers a_i and b_i (0 ≤ a_i, b_i ≤ 10^9), representing the stock price of stock i. 

Output

If it is impossible for Bob to achieve his goal, output a single integer -1.

Otherwise, output two integers T and E, where T is the minimum time in which he can achieve his goal, and E is the minimum number of exchanges in which he can achieve his goal at time T.

Examples

Input


1
3 10
1 16


Output


3 1


Input


2
3 0
2 1
1 10
1 11


Output


6 3


Input


1
42 42
47 47


Output


-1


Input


8
145 1729363
891 4194243
424 853731
869 1883440
843 556108
760 1538373
270 762781
986 2589382
610 99315884
591 95147193
687 99248788
65 95114537
481 99071279
293 98888998
83 99764577
769 96951171


Output


434847 11


Input


8
261 261639
92 123277
271 131614
320 154417
97 258799
246 17926
117 222490
110 39356
85 62864876
86 62781907
165 62761166
252 62828168
258 62794649
125 62817698
182 62651225
16 62856001


Output


1010327 11

Note

In the first example, Bob simply waits until time t = 3, when both stocks cost exactly the same amount.

In the second example, the optimum strategy is to exchange stock 2 for stock 1 at time t = 1, then exchange one share of stock 1 for stock 3 at time t = 5 (where both cost 15) and then at time t = 6 exchange the second on for the stock number 4 (when they cost 18 and 17, respectively). Note that he can achieve his goal also with only two exchanges, but this would take total time of t = 9, when he would finally be able to exchange the share number 2 for the share number 3. 

In the third example, Bob can never achieve his goal, as the second stock is always strictly more expensive than the first one.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
void chkmin(T &x, const T &y) {
  if (y < x) {
    x = y;
  }
}
template <class T>
void chkmax(T &x, const T &y) {
  if (y > x) {
    x = y;
  }
}
template <class T>
void sort(vector<T> &a) {
  sort(a.begin(), a.end());
}
template <class T>
void reverse(vector<T> &a) {
  reverse(a.begin(), a.end());
}
void reverse(string &a) { reverse(a.begin(), a.end()); }
template <class T, class Cmp>
void sort(vector<T> &a, Cmp cmp) {
  sort(a.begin(), a.end(), cmp);
}
template <class T>
void unique(vector<T> &a) {
  a.resize(unique(a.begin(), a.end()) - a.begin());
}
int readInt() {
  int x = 0;
  bool sign = false;
  char c = getchar();
  while (!isdigit(c)) {
    sign = c == '-';
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return sign ? -x : x;
}
ll readLong() {
  ll x = 0;
  bool sign = false;
  char c = getchar();
  while (!isdigit(c)) {
    sign = c == '-';
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return sign ? -x : x;
}
string readString() {
  string s;
  char c = getchar();
  while (isspace(c)) {
    c = getchar();
  }
  while (!isspace(c)) {
    s += c;
    c = getchar();
  }
  return s;
}
class Flow {
 private:
  struct Edge {
    int to, f, c, next;
    Edge(int to, int f, int c, int next) : to(to), f(f), c(c), next(next) {}
  };
  int V;
  vector<int> head;
  vector<Edge> edges;
  vector<int> from, h, dis;
  bool SP(int S, int T) {
    from.assign(V, -1);
    dis.assign(V, 1e9);
    vector<vector<int>> ver(1);
    dis[S] = 0;
    ver[0].push_back(S);
    for (int D = 0; D < ver.size(); ++D) {
      while (!ver[D].empty()) {
        int u = ver[D].back();
        ver[D].pop_back();
        if (dis[u] != D) {
          continue;
        }
        for (int i = head[u]; i != -1;) {
          auto [v, f, c, next] = edges[i];
          if (c > 0 && dis[v] + h[v] > dis[u] + h[u] + f) {
            dis[v] = dis[u] + h[u] - h[v] + f;
            from[v] = i;
            if (dis[v] >= ver.size()) {
              ver.resize(dis[v] + 1);
            }
            ver[dis[v]].push_back(v);
          }
          i = next;
        }
      }
    }
    return dis[T] != 1e9;
  }

 public:
  Flow(int V) : V(V) { head.assign(V, -1); }
  void insert_edge(int u, int v, int f, int c) {
    edges.emplace_back(v, f, c, head[u]);
    head[u] = edges.size() - 1;
    edges.emplace_back(u, -f, 0, head[v]);
    head[v] = edges.size() - 1;
  }
  int MCMF(int S, int T) {
    h.resize(V);
    int cost = 0;
    while (SP(S, T)) {
      int mn = 1e9;
      for (int i = 0; i < V; ++i) {
        h[i] += dis[i];
      }
      for (int u = T; u != S; u = edges[from[u] ^ 1].to) {
        chkmin(mn, edges[from[u]].c);
      }
      for (int u = T; u != S; u = edges[from[u] ^ 1].to) {
        edges[from[u]].c -= mn;
        edges[from[u] ^ 1].c += mn;
      }
      cost += mn * h[T];
    }
    return cost;
  }
};
void solve_single_test(int test_id = 1) {
  int n = readInt();
  vector<int> a(n * 2), b(n * 2);
  for (int i = 0; i < n * 2; ++i) {
    a[i] = readInt();
    b[i] = readInt();
  }
  int l = 0, r = 1e9 + 1;
  while (l < r) {
    int T = (l + r) / 2;
    vector<ll> goal, have;
    bool ok = true;
    ll mx = 0;
    vector<tuple<int, ll, char>> stocks(n * 2);
    for (int i = 0; i < n * 2; ++i) {
      stocks[i] = {b[i], -1ll * a[i] * T - b[i], i < n};
    }
    sort(stocks);
    for (auto [x, y, op] : stocks) {
      chkmax(mx, -y);
      if (op) {
        have.push_back(mx);
      } else {
        goal.push_back(-y);
      }
    }
    sort(goal);
    for (int i = 0; i < n; ++i) {
      if (have[i] < goal[i]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      r = T;
    } else {
      l = T + 1;
    }
  }
  if (r > 1e9) {
    puts("-1");
    return;
  }
  Flow G(n * 6 + 2);
  int S = n * 6, T = S + 1;
  for (int i = 0; i < n; ++i) {
    G.insert_edge(S, i, 0, 1);
    G.insert_edge(i, i + n * 2, 0, 1);
    G.insert_edge(i, i + n * 4, 0, 1);
  }
  for (int i = n; i < n * 2; ++i) {
    G.insert_edge(i, T, 0, 1);
    G.insert_edge(i + n * 2, i, 0, 1);
    G.insert_edge(i + n * 4, i, 0, 1);
  }
  vector<int> seq(n);
  for (int i = 0; i < n; ++i) {
    seq[i] = i;
  }
  sort(seq, [&](int x, int y) { return b[x] < b[y]; });
  for (int i = 0; i + 1 < n; ++i) {
    G.insert_edge(seq[i + 1] + n * 4, seq[i] + n * 4, 0, 1e9);
  }
  vector<int> tp(n * 2);
  for (int i = 0; i < n * 2; ++i) {
    tp[i] = i;
  }
  sort(tp, [&](int x, int y) { return b[x] < b[y]; });
  for (int i = 0, j = 0; i < n * 2; ++i) {
    int x = tp[i];
    while (j < n && b[seq[j]] < b[x]) {
      ++j;
    }
    if (j < n) {
      G.insert_edge(seq[j] + n * 4, x + n * 2, 1, 1e9);
    }
  }
  for (int i = 0; i < n; ++i) {
    seq[i] = i + n;
  }
  sort(seq, [&](int x, int y) {
    return 1ll * a[x] * l + b[x] > 1ll * a[y] * l + b[y];
  });
  for (int i = 0; i + 1 < n; ++i) {
    G.insert_edge(seq[i] + n * 4, seq[i + 1] + n * 4, 0, 1e9);
  }
  sort(tp, [&](int x, int y) {
    return 1ll * a[x] * l + b[x] > 1ll * a[y] * l + b[y];
  });
  for (int i = 0, j = 0; i < n * 2; ++i) {
    int x = tp[i];
    while (j < n && 1ll * a[seq[j]] * l + b[seq[j]] > 1ll * a[x] * l + b[x]) {
      ++j;
    }
    if (j < n) {
      G.insert_edge(x + n * 2, seq[j] + n * 4, 1, 1e9);
    }
  }
  printf("%d %d\n", l, G.MCMF(S, T));
}
void solve_multiple_tests() {
  int n_tests = readInt();
  for (int i = 1; i <= n_tests; ++i) {
    solve_single_test(i);
  }
}
int main() {
  solve_single_test();
  return 0;
}