#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define int unsigned long long

using namespace std;

const int N = 1005;

int n;

pair <int, int> ar[N];

main ()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        scanf("%d%d", &ar[i].fr, &ar[i].sc);

    for (int i = 2; i <= n; i++)
    {
        int l = 0, r = 2e18 / max( ar[i].fr, ar[i].sc );

        while (r - l > 1)
        {
            int md = (l + r) >> 1;
            if ( ar[i].fr * md >= ar[i - 1].fr && ar[i].sc * md >= ar[i - 1].sc )
                r = md;
            else
                l = md;
        }
        ar[i].fr *= r;
        ar[i].sc *= r;
    }
    cout << ar[n].fr + ar[n].sc << endl;
}
