#include <bits/stdc++.h>
using namespace std;

int main() {
  long long int N, T = 1, A = 1;
  cin >> N;
  for (long long int i = 0; i < N; i++) {
    long long int t, a;
    cin >> t >> a;
    long long int n = max((T + t - 1) / t, (A + a - 1) / a);
    T = n * t;
    A = n * a;
  }
  cout << T + A << endl;
}