void main()
{
    long n = readln.chomp.to!long;

    long x = 1, y = 1;
    foreach (i; 0 .. n)
    {
        long[] tmp = readln.split.to!(long[]);
        long t = tmp[0], a = tmp[1];

        long m = max((x+t-1)/t, (y+a-1)/a);
        x = m * t, y = m * a;
    }

    writeln(x + y);
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;