#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;

int n;
pair<int,int> arr[1005];

int main(){
    cin >> n;
    long long nowMinFir = 1 , nowMinSec = 1;
    arr[0].first = arr[0].second = 1;
    for(int i=1 ; i<=n ; i++){
        cin >> arr[i].first >> arr[i].second;
        int mulFir = nowMinFir / arr[i].first;
        int mulSec = nowMinSec / arr[i].second;
        int mul = max(mulFir,mulSec);
        if(mul * arr[i].first < nowMinFir || mul * arr[i].second < nowMinSec)
            mul++;
        nowMinFir = mul * arr[i].first;
        nowMinSec = mul * arr[i].second;
    }
    cout << nowMinFir + nowMinSec << "\n";
}

