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

int main() {
    int n;cin>>n;
    ll a=1,b=1;
    while (n--) {
        int c,d;
        cin>>c>>d;
        ll m=max((a+c-1)/c,(b+d-1)/d);
        a=c*m;
        b=d*m; 
    }
    cout<<a+b<<endl;
    return 0;
}