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

int main() {
  int N;
  cin >> N;

  vector<int> T(N), A(N);
  rep(i, N) cin >> T[i] >> A[i];

  ll t = 1, a = 1;
  rep(i, N) {
    ll n = max((t + T[i] - 1) / T[i], (a + A[i] - 1) / A[i]);
    t = T[i] * n;
    a = A[i] * n;
  }

  cout << t + a << endl;
}