#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll a[100010],b[100010];

int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	ll nowa=1,nowb=1;
	for(int i=0;i<n;i++){
		ll so=(a[i]+nowa-1)/a[i];
		so=max(so,(b[i]+nowb-1)/b[i]);
		nowa=a[i]*so;nowb=b[i]*so;
	}
	cout << nowa+nowb;
	return 0;
}