#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n,a,b;
	long long x=1,y=1;
	long long mid;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		mid=max(x/a,y/b);
		while(mid*a<x || mid*b<y)
			mid++;
		x=mid*a;
		y=mid*b;	
	}
	cout<<x+y<<endl;
	return 0;
}