#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>


using namespace std;



int main() {
	int n;
	cin >> n;
	long long minx = 1, miny = 1;
	for (int i = 0; i < n; i++) {
		int t, a;
		cin >> t >> a;
		for (int j = minx; ; j++) {
			int newy = j * t / a;
			if (j * a % t == 0 && j * a / t >= miny) {
				minx = j;
				miny = j * a / t;
				break;
			};
		}
	}
	cout << minx + miny << endl;




}


