import std.stdio, std.string, std.array, std.conv, std.algorithm, std.typecons, std.range, std.container, std.math, std.algorithm.searching, std.functional,std.mathspecial;

void main(){
    auto n=readln().chomp.to!int;
    int[] Ts;
    int[] As;
    foreach(i;0..n){
        auto ln=readln.split.map!(to!int).array;
        Ts~=ln[0];
        As~=ln[1];
    }

    foreach(i;1..n){
        long rate=max(1+((long)Ts[i-1]-1)/Ts[i],1+((long)As[i-1]-1)/As[i]);
        Ts[i]*=rate;
        As[i]*=rate;
    }
    writeln(Ts[n-1]+As[n-1]);
}