import std.stdio,
	std.conv,
	std.algorithm,
	std.range,
	std.string,
	std.numeric;

void main() {
	size_t a,b;
	auto n = readln.chomp.to!size_t - 1;
	auto ary = readln.chomp.split.to!(size_t[]);
	a = ary[0];
	b = ary[1];
	foreach(cnt;0..n){
		auto tmp = readln.chomp.split.to!(size_t[]);
		auto inp_x = tmp[0];
		auto inp_y = tmp[1];
		immutable ratio = max((a-1)/inp_x+1,(b-1)/inp_y+1);
		a = inp_x * ratio;
		b = inp_y * ratio;
	}
	writeln(a+b);
}
