import std.stdio, std.algorithm, std.conv, std.array, std.string;

void main()
{
    ulong t = 1, a = 1;
    auto n = readln.chomp.to!int;

    foreach (_i; 0..n) {
        ulong tp, ap, tpo, apo;
        readf("%d %d", &tp, &ap); readln;
        tpo = tp; apo = ap;

        while (tp < t || ap < a) {
            tp += tpo;
            ap += apo;
        }

        t = tp; a = ap;
    }

    writeln(t + a);
}