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

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