#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
#define rep(x, n) for (int x = 1; x <= n; ++x)
#define zrp(x, n) for (int x = n; x; --x)
#define FOR(x, l, r) for (int x = l; x <= r; ++x)

int main()
{
	int n;
	scanf("%d", &n);
	long long ans = 1;
	long long a = 0, b = 0;
	rep(m, n)
	{
		long long x, y;
		cin >> x >> y;
		ans = (ans / (x + y) + (bool)(ans % (x + y))) * (x + y); 
		long long i, j;
		i = ans / (x + y) * x;
		j = ans / (x + y) * y;
		
		if (i < a || j < b)
		{
			long long t = (a - i) / x + bool((a - i) % x);
			long long h = (b - j) / y + bool((b - j) % y);
			t = max(h, t);
			ans += t * (x + y);
		}
		a = ans / (x + y) * x;
		b = ans / (x + y) * y;
	}
	cout << ans << endl;
	return 0;
}
