#include <bits/stdc++.h>
using namespace std;
const int N = 100005, M = N, inf = INT_MAX >> 3;
using ll = long long;
int n;
namespace FlowGraph {
int head[N], v[M], nxt[M], c[M], ptr, t;
int w[M], cost;
inline void padd_edge(int uu, int vv, int ww, int cc) {
  v[ptr] = vv;
  w[ptr] = ww;
  c[ptr] = cc;
  nxt[ptr] = head[uu];
  head[uu] = ptr++;
}
int dis[N], id[N], cur[N];
bool vis[N];
bool spfa(int s, int t) {
  memset(vis, 0, sizeof(vis));
  memset(dis, -1, sizeof(dis));
  queue<int> q;
  q.push(s);
  dis[s] = 0;
  id[s] = 1;
  while (!q.empty()) {
    int nd = q.front();
    q.pop();
    vis[nd] = 0;
    for (int i = head[nd]; i != -1; i = nxt[i])
      if (w[i] && (dis[v[i]] == -1 || dis[v[i]] > dis[nd] + c[i])) {
        dis[v[i]] = dis[nd] + c[i];
        if (!vis[v[i]]) vis[v[i]] = 1, q.push(v[i]);
      }
  }
  return dis[t] != -1;
}
int dfs(int pos, int flow) {
  if (pos == t) return flow;
  vis[pos] = 1;
  int tmp = flow;
  for (int &i = cur[pos]; i != -1; i = nxt[i])
    if (!vis[v[i]] && w[i] && dis[v[i]] == dis[pos] + c[i]) {
      cur[pos] = i;
      int fl = dfs(v[i], min(flow, w[i]));
      cost += fl * c[i];
      w[i] -= fl;
      w[i ^ 1] += fl;
      flow -= fl;
      if (!flow) break;
    }
  return tmp - flow;
}
inline void init() {
  memset(head, -1, sizeof(head));
  memset(nxt, -1, sizeof(nxt));
}
inline void add_edge(int uu, int vv, int ww, int cc) {
  padd_edge(uu, vv, ww, cc);
  padd_edge(vv, uu, 0, -cc);
}
int dinic(int ss, int tt) {
  cost = 0;
  t = tt;
  ll flow = 0;
  while (spfa(ss, tt)) memcpy(cur, head, sizeof(cur)), flow += dfs(ss, inf);
  assert(flow == n);
  return cost;
}
};  // namespace FlowGraph
int p1[N], p2[N];
ll k[N], b[N], val[N];
bool check(int mid) {
  ll mx = 0;
  for (int i = 1; i <= n * 2; i++) p1[i] = p2[i] = i;
  sort(p1 + 1, p1 + n * 2 + 1,
       [](int x, int y) { return b[x] == b[y] ? k[x] > k[y] : b[x] < b[y]; });
  sort(p2 + n + 1, p2 + n * 2 + 1,
       [&](int x, int y) { return k[x] * mid + b[x] < k[y] * mid + b[y]; });
  for (int i = 1; i <= n * 2; i++) {
    mx = max(mx, k[p1[i]] * mid + b[p1[i]]);
    if (p1[i] <= n) val[p1[i]] = mx;
  }
  sort(val + 1, val + n + 1);
  for (int i = n; i > 0; --i)
    if (val[i] < k[p2[i + n]] * mid + b[p2[i + n]]) return 0;
  return 1;
}
int in[N], out[N], pre[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n * 2; i++) cin >> k[i] >> b[i];
  int l = 0, r = INT_MAX >> 1, ans = -1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  if (ans == -1) {
    cout << -1 << endl;
    return 0;
  }
  FlowGraph::init();
  int idx = 0;
  int ss = ++idx, tt = ++idx;
  for (int i = 1; i <= n * 2; i++) {
    in[i] = ++idx;
    out[i] = ++idx;
    if (i <= n)
      FlowGraph::add_edge(ss, in[i], 1, 0);
    else
      FlowGraph::add_edge(out[i], tt, 1, 0);
    FlowGraph::add_edge(in[i], out[i], inf, 0);
  }
  for (int i = 1; i <= n * 2; i++) p1[i] = i;
  sort(p1 + 1, p1 + n * 2 + 1, [](int x, int y) { return b[x] < b[y]; });
  pre[1] = in[p1[1]];
  for (int i = 2; i <= n * 2; i++) {
    pre[i] = ++idx;
    FlowGraph::add_edge(pre[i], pre[i - 1], inf, 0);
    FlowGraph::add_edge(pre[i], in[p1[i]], inf, 0);
    FlowGraph::add_edge(in[p1[i]], pre[i - 1], inf, 1);
  }
  for (int i = 1; i <= n * 2; i++) p2[i] = i;
  sort(p2 + 1, p2 + n * 2 + 1, [&](int x, int y) {
    return make_pair(k[x] * ans + b[x], y) < make_pair(k[y] * ans + b[y], x);
  });
  pre[1] = out[p2[1]];
  for (int i = 2; i <= n * 2; i++) {
    pre[i] = ++idx;
    FlowGraph::add_edge(pre[i], pre[i - 1], inf, 0);
    FlowGraph::add_edge(pre[i], out[p2[i]], inf, 0);
    FlowGraph::add_edge(out[p2[i]], pre[i - 1], inf, 1);
  }
  cout << ans << ' ' << FlowGraph::dinic(ss, tt) << endl;
  return 0;
}
