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

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