#include<cstdio>
#define LL long long
#define Max(a,b) a>b?a:b
int main()
{
	int n,x,y;
	LL A,B,c;
	scanf("%d",&n);
	scanf("%lld%lld",&A,&B);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		c=Max((A-1)/x+1,(B-1)/y+1);
		A=c*x,B=c*y;
	}
	printf("%lld\n",A+B);
}