#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
struct man {
  double nsp;
  double speed;
  int c;
  bool iki;
  double dis;
  man(double nsp, double speed, int c, bool iki, double dis)
      : nsp(nsp), speed(speed), c(c), iki(iki), dis(dis) {}
  man() {}
};
double dis(man a, man b) {
  if (a.iki ^ b.iki) {
    return 1.0 - a.dis + b.dis;
  } else {
    double tmp = b.dis - a.dis;
    if (tmp < 1e-8)
      return 2.0 - tmp;
    else
      return tmp;
  }
}
struct event {
  double time;
  int type;
  int id;
  int front;
  event(double time, int type, int id, int front)
      : time(time), type(type), id(id), front(front) {}
  event() {}
};
const bool operator<(const event &a, const event &b) { return a.time < b.time; }
int main() {
  int n;
  while (cin >> n, n) {
    vector<man> m(n);
    for (int i = 0; i < (int)n; ++i) {
      int t, c;
      cin >> t >> c;
      m[i] = man(1.0 / t, 1.0 / t, c, 1, 0);
    }
    vector<event> events;
    for (int i = 0; i < (int)n; ++i) {
      events.push_back(event(1.0 / m[i].nsp, 1, i, 0));
      for (int j = 0; j < (int)n; ++j) {
        if (i == j) continue;
        if (m[i].nsp <= m[j].nsp) continue;
        events.push_back(event(2.0 / (m[i].nsp - m[j].nsp), 0, i, j));
      }
    }
    double ans = 0;
    while (1) {
      event e = *min_element((events).begin(), (events).end());
      double time = e.time;
      for (int i = 0; i < (int)m.size(); ++i) {
        m[i].dis += m[i].nsp * time;
      }
      ans += time;
      if (e.type == 0) {
        m[e.id].nsp = m[e.front].nsp;
      } else {
        m[e.id].dis = 0;
        m[e.id].iki ^= 1;
        m[e.id].nsp = m[e.id].speed;
        if (m[e.id].iki) {
          m[e.id].c--;
          if (m[e.id].c == 0) {
            m.erase(m.begin() + e.id);
            if (m.size() == 0) break;
          }
        }
      }
      events.clear();
      for (int i = 0; i < (int)m.size(); ++i) {
        events.push_back(event((1.0 - m[i].dis) / m[i].nsp, 1, i, 0));
        for (int j = 0; j < (int)m.size(); ++j) {
          if (i == j) continue;
          if (m[i].nsp <= m[j].nsp) continue;
          events.push_back(
              event(dis(m[i], m[j]) / (m[i].nsp - m[j].nsp), 0, i, j));
        }
      }
    }
    cout << ans << endl;
  }
}
