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;
const double pi = acos(0.0) * 2.0;
const long double eps = 1e-10;
const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0},  {0, -1},
                        {-1, 1}, {1, 1}, {1, -1}, {-1, -1}};
template <class T>
inline T abs1(T a) {
  return a < 0 ? -a : a;
}
template <class T>
inline T max1(T a, T b) {
  return b < a ? a : b;
}
template <class T>
inline T max1(T a, T b, T c) {
  return max1(max1(a, b), c);
}
template <class T>
inline T max1(T a, T b, T c, T d) {
  return max1(max1(a, b, c), d);
}
template <class T>
inline T max1(T a, T b, T c, T d, T e) {
  return max1(max1(a, b, c, d), e);
}
template <class T>
inline T min1(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T min1(T a, T b, T c) {
  return min1(min1(a, b), c);
}
template <class T>
inline T min1(T a, T b, T c, T d) {
  return min1(min1(a, b, c), d);
}
template <class T>
inline T min1(T a, T b, T c, T d, T e) {
  return min1(min1(a, b, c, d), e);
}
inline int jud(double a, double b) {
  if (abs(a) < eps && abs(b) < eps)
    return 0;
  else if (abs1(a - b) / max(abs1(a), abs1(b)) < eps)
    return 0;
  if (a < b) return -1;
  return 1;
}
template <typename t>
inline int jud(t a, t b) {
  if (a < b) return -1;
  if (a == b) return 0;
  return 1;
}
template <typename it, typename t1>
inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1) {
  if (na == 0) return 0;
  int be = 0, en = na - 1;
  if (*a <= *(a + na - 1)) {
    if (f_lb == 0)
      while (be < en) {
        int mid = (be + en + 1) / 2;
        if (jud(*(a + mid), val) != 1)
          be = mid;
        else
          en = mid - 1;
      }
    else
      while (be < en) {
        int mid = (be + en) / 2;
        if (jud(*(a + mid), val) != -1)
          en = mid;
        else
          be = mid + 1;
      }
    if (f_small && jud(*(a + be), val) == 1) be--;
    if (!f_small && jud(*(a + be), val) == -1) be++;
  } else {
    if (f_lb)
      while (be < en) {
        int mid = (be + en + 1) / 2;
        if (jud(*(a + mid), val) != -1)
          be = mid;
        else
          en = mid - 1;
      }
    else
      while (be < en) {
        int mid = (be + en) / 2;
        if (jud(*(a + mid), val) != 1)
          en = mid;
        else
          be = mid + 1;
      }
    if (!f_small && jud(*(a + be), val) == -1) be--;
    if (f_small && jud(*(a + be), val) == 1) be++;
  }
  return be;
}
template <class T>
inline T lowb(T num) {
  return num & (-num);
}
long long pow(long long n, long long m, long long mod = 0) {
  if (m < 0) return 0;
  long long ans = 1;
  long long k = n;
  while (m) {
    if (m & 1) {
      ans *= k;
      if (mod) ans %= mod;
    }
    k *= k;
    if (mod) k %= mod;
    m >>= 1;
  }
  return ans;
}
template <class t1, class t2>
inline void add(t1 &a, t2 b, int mod = -1) {
  if (mod == -1) mod = 1000000007;
  a += b;
  while (a >= mod) a -= mod;
  while (a < 0) a += mod;
}
template <class t>
void output1(t arr) {
  for (int i = 0; i < (int)arr.size(); i++) cerr << arr[i] << ' ';
  cerr << endl;
}
template <class t>
void output2(t arr) {
  for (int i = 0; i < (int)arr.size(); i++) output1(arr[i]);
}
const int maxn = 2210;
const int inff = 0x3f3f3f3f;
const int infc = 0x3f3f3f3f;
const int E = 700100;
const int N = maxn * 10;
struct network {
  int nv, ne, pnt[E], nxt[E];
  int vis[N], que[N], head[N], pv[N], pe[N];
  int flow, cap[E];
  int cost, dis[E], d[N];
  void addedge(int u, int v, int c, int w) {
    pnt[ne] = v;
    cap[ne] = c;
    dis[ne] = +w;
    nxt[ne] = head[u];
    head[u] = (ne++);
    pnt[ne] = u;
    cap[ne] = 0;
    dis[ne] = -w;
    nxt[ne] = head[v];
    head[v] = (ne++);
  }
  int mincost(int src, int sink) {
    int i, k, f, r;
    int mxf;
    for (flow = 0, cost = 0;;) {
      memset(pv, -1, sizeof(pv));
      memset(vis, 0, sizeof(vis));
      for (i = 0; i < nv; ++i) d[i] = infc;
      d[src] = 0;
      pv[src] = src;
      vis[src] = 1;
      for (f = 0, r = 1, que[0] = src; r != f;) {
        i = que[f++];
        vis[i] = 0;
        if (N == f) f = 0;
        for (k = head[i]; k != -1; k = nxt[k])
          if (cap[k] && dis[k] + d[i] < d[pnt[k]]) {
            d[pnt[k]] = dis[k] + d[i];
            if (0 == vis[pnt[k]]) {
              vis[pnt[k]] = 1;
              que[r++] = pnt[k];
              if (N == r) r = 0;
            }
            pv[pnt[k]] = i;
            pe[pnt[k]] = k;
          }
      }
      if (-1 == pv[sink]) break;
      for (k = sink, mxf = inff; k != src; k = pv[k])
        if (cap[pe[k]] < mxf) mxf = cap[pe[k]];
      flow += mxf;
      cost += d[sink] * mxf;
      for (k = sink; k != src; k = pv[k]) {
        cap[pe[k]] -= mxf;
        cap[pe[k] ^ 1] += mxf;
      }
    }
    return cost;
  }
  void init(int v) {
    nv = v;
    ne = 0;
    memset(head, -1, sizeof(head));
  }
} g;
int n;
pair<long long, long long> co[maxn * 2];
int arr1[maxn * 2], arr2[maxn * 2];
int loc[maxn * 2], cnt[maxn * 2];
long long GetValue(int no, long long t) {
  return co[no].first * t + co[no].second;
}
bool Judge(long long mid) {
  for (int i = 0; i < 2 * n; i++) {
    arr1[i] = i;
    arr2[i] = i;
  }
  sort(arr1, arr1 + 2 * n, [&](const int &a, const int &b) {
    if (co[a].second == co[b].second) {
      if (GetValue(a, mid) == GetValue(b, mid)) {
        return a > b;
      }
      return GetValue(a, mid) > GetValue(b, mid);
    }
    return co[a].second < co[b].second;
  });
  sort(arr2, arr2 + 2 * n, [&](const int &a, const int &b) {
    if (GetValue(a, mid) == GetValue(b, mid)) {
      if (co[b].second == co[a].second) {
        return a > b;
      }
      return co[b].second < co[a].second;
    }
    return GetValue(a, mid) < GetValue(b, mid);
  });
  for (int i = 0; i < 2 * n; i++) loc[arr2[i]] = i;
  memset(cnt, 0, sizeof(cnt));
  int rmax_loc = -1;
  for (int i = 0; i < 2 * n; i++) {
    rmax_loc = max(loc[arr1[i]], rmax_loc);
    if (arr1[i] < n) cnt[rmax_loc]++;
  }
  for (int i = 2 * n, sum = 0; i >= 0; i--) {
    sum += cnt[i];
    if (arr2[i] >= n) sum--;
    if (sum < 0) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long l = 0, r = 1ll << 31;
  scanf("%d", &n);
  for (int i = 0; i < 2 * n; i++) {
    scanf("%I64d%I64d", &co[i].first, &co[i].second);
  }
  while (l != r) {
    long long mid = (l + r) / 2;
    if (!Judge(mid)) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  if (!Judge(l)) {
    puts("-1");
  } else {
    int src = n * 8, sink = n * 8 + 1;
    g.init(n * 8 + 2);
    for (int i = 0; i < 2 * n; i++) {
      if (i < n) {
        g.addedge(src, i, 1, 0);
      } else {
        g.addedge(i + 2 * n, sink, 1, 0);
      }
      g.addedge(i, i + 2 * n, n, 0);
      g.addedge(arr2[i] + 2 * n, arr2[i] + 4 * n, n, 1);
      g.addedge(arr2[i] + 4 * n, arr2[i] + 2 * n, 1, 0);
      g.addedge(arr1[i], arr1[i] + 6 * n, 1, 1);
      g.addedge(arr1[i] + 6 * n, arr1[i], n, 0);
      if (i) {
        g.addedge(arr1[i] + 6 * n, arr1[i - 1] + 6 * n, n, 0);
        g.addedge(arr2[i] + 4 * n, arr2[i - 1] + 4 * n, n, 0);
      }
    }
    printf("%I64d %d\n", l, g.mincost(src, sink));
  }
  return 0;
}