#include <iostream>
using namespace std;

int main(){
	long long n, l, r;
	cin >> n >> l >> r;
	n--;
	while(n--){
		long long t, a;
		cin >> t >> a;
		long long p = max((l + t - 1) / t, (r + a - 1) / a);
		l = t * p;
		r = a * p;
	}
	cout << l + r << endl;
}