#include <iostream>
#include <algorithm>

using namespace std;

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