#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	int64_t t = 1;
	int64_t a = 1;

	for( int i = 0; i < N; ++i ) {
		int T, A;
		cin >> T >> A;

		int64_t n = max( (t + T-1) / T, (a + A-1) / A );
		t = n * T;
		a = n * A;
	}

	cout << (t+a) << endl;
}
