#include<iostream>
using namespace std;
int main(){
	int a[1001],b[1001];
	long long n,resa=1,resb=1,biggist;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		if((resb+b[i]-1)/b[i]>=(resa+a[i]-1)/a[i]){
			biggist=(resb+b[i]-1)/b[i];
		}else{
			biggist=(resa+a[i]-1)/a[i];
		}
		resa=a[i]*biggist;
		resb=b[i]*biggist;
	}
	cout<<resa+resb;
	return 0;
}