#include <bits/stdc++.h>
using namespace std;
const double MID = 1000;
const double GOAL = 2000;
const double eps = 1e-10;
const double inf = 1e100;
class state {
 public:
  double x, v, oriv;
  int cnt;
  bool operator<(const state& a) const {
    if (!(fabs(x - a.x) < eps)) return x < a.x;
    return v < a.v;
  }
};
double compute_time(double x1, double x2, double v1, double v2) {
  if (x1 > x2) return inf;
  if (v1 - v2 < eps) return inf;
  if (fabs(v1 - v2) < eps) return inf;
  return (x2 - x1) / (v1 - v2);
}
int solve(int n, vector<state>& in) {
  double ans = 0;
  while (n) {
    double mint = inf;
    for (int i = 0; i < n; i++) {
      if (fabs(in[i].x - MID) > eps)
        mint = min(mint, compute_time(in[i].x, MID, in[i].v, 0));
      if (fabs(in[i].x - GOAL) > eps)
        mint = min(mint, compute_time(in[i].x, GOAL, in[i].v, 0));
      for (int j = i + 1; j < n; j++) {
        if (fabs(in[i].x - in[j].x) > eps)
          mint = min(mint, compute_time(in[i].x, in[j].x, in[i].v, in[j].v));
      }
    }
    ans += mint;
    assert(mint > 0);
    for (int i = 0; i < n; i++) {
      in[i].x += in[i].v * mint;
    }
    sort((in).begin(), (in).end());
    for (int i = 0; i < n; i++) {
      if (fabs(in[i].x - MID) < eps) {
        in[i].v = in[i].oriv;
      } else if (fabs(in[i].x - GOAL) < eps) {
        in[i].v = in[i].oriv;
        in[i].x = 0;
        in[i].cnt--;
        if (in[i].cnt == 0) in[i].x = inf;
      } else {
        for (int j = 0; j < n; j++) {
          if (fabs(in[i].x - in[j].x) < eps) in[i].v = min(in[i].v, in[j].v);
        }
      }
    }
    sort((in).begin(), (in).end());
    for (int i = n - 1; i >= 0; i--) {
      if (in[i].x > 2500) n--;
    }
  }
  if (fabs((int)(ans + 0.5) - ans) < eps) return (int)(ans + 0.5);
  return (int)ans;
}
int main() {
  int n;
  while (cin >> n && n) {
    vector<state> in;
    for (int i = 0; i < n; i++) {
      double t;
      int lap;
      cin >> t >> lap;
      in.push_back((state){0, 1000 / t, 1000 / t, lap});
    }
    cout << solve(n, in) << endl;
  }
}
