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;
    long[] Ts;
    long[] As;
    foreach(i;0..n){
        auto ln=readln.split.map!(to!long).array;
        Ts~=ln[0];
        As~=ln[1];
    }

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