#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAX=1e16;
const int INF=1e6+100;
int main()
{
    int n,a,b;
    cin>>n;
    ll x=1,y=1;
    ll r,l,mid;
    for(int i=0; i<n; i++){
        cin>>a>>b;
        mid=max(x/a,y/b);
        while(mid*a<x || mid*b<y) mid++;
        x=mid*a;
        y=mid*b;
    }
    cout<<x+y<<endl;
    return 0;
}
