#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, nt = 1, na = 1, t, a, p;
  cin >> n;

  rep(i, n) {
    cin >> t >> a;
    p = max(ceil(nt / (long double)t), ceil(na / (long double)a));
    nt = p * t;
    na = p * a;
  }

  cout << nt + na << endl;
  return 0;
}
