#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
#define N 5010
using namespace std;

ll l,last,ans,a,b,n;

int main()
{
	ll i,j,p,q;
	cin>>n;
	cin>>a>>b;
	for(i=2;i<=n;i++)
	{
		scanf("%lld%lld",&p,&q);
		a=(a/p+(a%p!=0))*p;
		if(b<=a/p*q) b=a/p*q;
		else
		{
			b=(b/q+(b%q!=0))*q;
			a=b/q*p;
		}
	}
	cout<<a+b;
}