#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    ll N; cin >> N;
    vector<ll> t(N), a(N);
    rep(i, N) cin >> t[i] >> a[i];

    // variable
    ll ans = 0;
    // solve
    ll nowt = 1, nowa = 1;
    rep(i, N){
        // print(i);
        if(nowt <= t[i] && nowa <= a[i]){
            nowt = t[i]; nowa = a[i];
            // print(nowt, nowa);
        }
        else if(nowt <= t[i] && nowa > a[i]){
            ll tmp = nowa;
            nowa = nowa / a[i] * a[i];
            if(tmp % a[i] != 0) nowa += a[i];
            nowt = nowa / a[i] * t[i];
            // print(nowt, nowa);
        }
        else if(nowt > t[i] && nowa <= a[i]){
            ll tmp = nowt;
            nowt = nowt / t[i] * t[i];
            if(tmp % t[i] != 0) nowt += t[i];
            nowa = nowt / t[i] * a[i];
            // print(nowt, nowa);
        }
        else{
            ll numt = nowt;
            ll numa = nowa;
            numa = numa / a[i] * a[i];
            if(nowa % a[i] != 0) numa += a[i];
            numt = numa / a[i] * t[i];
            ll numt2 = nowt;
            ll numa2 = nowa;
            numt2 = numt2 / t[i] * t[i];
            if(nowt % t[i] != 0) numt2 += t[i];
            numa2 = numt2 / t[i] * a[i];
            // print(numt, numa);
            // print(numt2, numa2);
            ll numsum = numt + numa;
            ll numsum2 = numt2 + numa2;
            if(numa < a[i] || numt < t[i] || numa < nowa || numt < nowt) numsum = LLINF;
            if(numa2 < a[i] || numt2 < t[i] || numa2 < nowa || numt2 < nowt) numsum2 = LLINF;
            if(numsum < numsum2){
                nowt = numt;
                nowa = numa;
            }
            else{
                nowt = numt2;
                nowa = numa2;
            }
        }
    }
    ans = nowt + nowa;
    print(ans);
    
    return 0;
}


Measured memory_bytes: 256