#include <bits/stdc++.h>
using namespace std;
struct data {
  int a, b;
  bool is;
  inline bool operator<(const data& x) const {
    return b ^ x.b ? b < x.b : a > x.a;
  }
} a[30800];
struct data1 {
  long long x;
  int y;
  inline bool operator<(const data1& a) const { return x < a.x; }
} a3[30800], a4[30800];
struct point {
  int next, to, w, w1;
} ar[30800];
bool is[30800];
long long a1[30800], a2[30800];
int T[3][30800];
int n, n1, a1t, a2t, tot, head[30800], art(1);
int a3t, a4t, ps, pt, fee, dis[30800], pre[30800];
inline bool check(int), bfs();
inline void read(int&), link(int, int, int, int);
int main() {
  read(n), tot = n1 = n << 1;
  for (int i(1); i <= n1; ++i) read(a[i].a), read(a[i].b), a[i].is = i <= n;
  sort(a + 1, a + n1 + 1);
  int l(0), mid, r(0x3f3f3f3f);
  while (mid = l + r >> 1, l < r) check(mid) ? r = mid : l = mid + 1;
  if (l == 0x3f3f3f3f) return puts("-1"), 0;
  for (int i(1); i <= n1; ++i)
    if (a[i].is) {
      if (tot > n1) link(i, tot, 1, 1);
    } else {
      link(++tot, i, 0x3f3f3f3f, 0);
      if (tot > n1 + 1) link(tot, tot - 1, 0x3f3f3f3f, 0);
    }
  for (int i(1); i <= n1; ++i) {
    long long j((long long)a[i].a * l + a[i].b);
    a1[i] = max(a1[i - 1], j);
    if (!a[i].is) a3[++a3t] = {j, ++tot}, link(tot, i, 0x3f3f3f3f, 0);
  }
  sort(a3 + 1, a3 + a3t + 1);
  for (int i(2); i <= n; ++i) link(a3[i].y, a3[i - 1].y, 0x3f3f3f3f, 0);
  for (int i(1), j(1); i <= n1; ++i)
    if (a[i].is) {
      while (j <= n && a3[j].x <= a1[i]) ++j;
      if (j > 1) link(i, a3[j - 1].y, 1, 2);
      a4[++a4t] = {(long long)l * a[i].a + a[i].b, i};
    }
  sort(a4 + 1, a4 + n + 1);
  for (int i(1), j(1); i <= n; ++i) {
    while (j <= n && a3[j].x <= a4[i].x) ++j;
    if (j > 1) link(a4[i].y, a3[j - 1].y, 1, 1);
  }
  ps = ++tot, pt = ++tot, memset(a1, 0, sizeof(a1));
  for (int i(1); i <= n1; ++i) a[i].is ? link(ps, i, 1, 0) : link(i, pt, 1, 0);
  while (bfs())
    ;
  return printf("%d %d", l, fee), 0;
}
inline bool bfs() {
  static int T[30800], is[30800], dis[30800], pre[30800];
  memset(dis, 0x3f, tot + 1 << 2);
  int L(0), R(1);
  dis[T[1] = ps] = 0;
  while (L ^ R)
    for (int i(head[is[T[++L %= 30800]] = 0, T[L]]); i; i = ar[i].next)
      if (ar[i].w && dis[ar[i].to] > dis[T[L]] + ar[i].w1) {
        dis[ar[i].to] = dis[T[L]] + ar[i].w1, pre[ar[i].to] = i;
        if (!is[ar[i].to]) is[T[++R %= 30800] = ar[i].to] = 1;
      }
  if (dis[pt] == 0x3f3f3f3f) return false;
  fee += dis[L = pt];
  while (pre[L]) --ar[pre[L]].w, ++ar[pre[L] ^ 1].w, L = ar[pre[L] ^ 1].to;
  return true;
}
inline void link(int u, int v, int w, int w1) {
  ar[++art] = {head[u], v, w, w1}, head[u] = art;
  ar[++art] = {head[v], u, 0, -w1}, head[v] = art;
}
inline bool check(int mid) {
  a1t = a2t = 0;
  long long temp(0);
  for (int i(1); i <= n1; ++i) {
    long long j((long long)a[i].a * mid + a[i].b);
    temp = max(temp, j);
    a[i].is ? a1[++a1t] = temp : a2[++a2t] = j;
  }
  sort(a2 + 1, a2 + n + 1);
  for (int i(1); i <= n; ++i)
    if (a1[i] < a2[i]) return false;
  return true;
}
inline void read(int& x) {
  x ^= x;
  register char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}
