#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >>N;
  long long int a,af,b,bf;
  af=1;
  bf=1;
  for(int i=0;i<N;i++){
    cin >> a>> b;
    long long int j=max(af/a,bf/b);
    while(a*j < af || b*j < bf){
      j++;
    }
        af = a*j;
        bf = b*j;
  }
  cout << af+bf << endl;
}
