function Main(s){
  s = s.split("\n").map(a => a.trim());
  const n = parseInt(s[0]);
  var ans = ["1", "1"];
  for(var i = 0; i < n; i++){
    var t = s[i+1].split(" ");
    var a = waru(ans[0], t[0], 1);
    a = max(a, waru(ans[1], t[1], 1));
    ans[0] = kakeru64(t[0], a);
    ans[1] = kakeru64(t[1], a);
  }
  console.log(tasu(ans[0], ans[1]));
}
function tasu(a,b){
	var c = +a.slice(-15) + b.slice(-15) * 1;
	var d = +a.slice(0, -15) + b.slice(0, -15) * 1 + Math.floor(c / 1e15);
	if(d > 0) c = ("00000000000000" + c).slice(-15);
	else d = "";
	return d + c;
}
function kakeru64(a,b){
	var c = +a.slice(-10);
	var d = +b.slice(-10);
	a = +a.slice(0, -10);
	b = +b.slice(0, -10);
	var e = kakeru32(c,d);
	var f = kakeru32(a,d)+"0000000000";
	f = tasu(kakeru32(b,c)+"0000000000",f);
	return tasu(e,f);
}
function kakeru32(a,b){
	var c = a % 1e5 * b;
	var d = Math.floor(a / 1e5) * b + Math.floor(c / 1e5);
	c %= 1e5;
	if(d > 0)c = ("00000" + c).slice(-5);
	else d = "";
	return d + c;
}
function waru(a,b,c){
	c = c||0;
	var d = +a.slice(-5);
	a = +a.slice(0, -5);
	var e = Math.floor(a / b);
	a = a % b * 1e5 + d;
	a /= b;
	switch(c){
		case 0: a = Math.floor(a);break;
		case 1: a = Math.ceil(a);break;
		case 2: a = Math.round(a);break;
	}
	if(e > 0)a = ("00000" + a).slice(-5);
	else e = "";
	return e + a;
}
function max(a,b){
	var al = a.length, bl = b.length;
	if(al < bl)return b;
	if(al > bl)return a;
	for(var i = 0;i < al; i++){
		if(a[i] < b[i])return b;
		if(a[i] > b[i])return a;
	}
	return a;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));