#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <algorithm>
#include <limits.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <math.h>
#include <set>
#define ll long long
#define MSET(x) memset((x), 0, sizeof((x)))
#define MMSET(x) memset((x), -1, sizeof((x)))
#define rep(i, a, b) for ( int (i) = a; (i) < (b) ; (i) ++ )
#define repA(i, a, b) for ( int (i) = a ;  (i) <= (b) ; (i) ++ )
#define repD(i, a, b) for ( int (i) = a; (i) >= (b) ; (i) -- )
#define fi first
#define se second
#define pb push_back
#define mfind(m, item) ((m).find((item)) != (m).end())
#define mp(a,b) make_pair((a),(b))
#define mt(a,b,c) make_pair(make_pair((a),(b)), (c))
#define tfi first.first
#define tse first.second
#define tth second
#define print cout << endl
#define tri pair<pair<int, int>, int>
using namespace std;
int n;
pair<ll, ll> nextSmall(ll a, ll b, ll t1, ll t2){
	ll r = 1000000000000000000, l = 0;
	while ( r - l > 1 ){
		ll m = (l + r)/ 2;
		ll k1 = t1 * m;
		if ( k1 < t1 ){
			r = m;
			continue;
		}
		ll k2 = t2 * m;
		if ( k2 < t2 ){
			r = m;
			continue;
		}
		if ( k1 >= a && k2 >= b ){
			r = m;
			continue;
		}
		else {
			l = m;
			
		}
	}	
	return make_pair(r * t1, r * t2);
}
int main(){
	cin >> n;
	ll a,b;
	a = 1;
	b = 1;
	ll t1, t2;
	for ( ll i = 0 ; i < n ; i ++ ){
		cin >> t1 >> t2;
		pair<ll,ll> temp = nextSmall(a,b,t1, t2);
		a = temp.first;
		b = temp.se;
	}
	cout << a + b << endl;
}