local mma = math.max
local n = io.read("*n")
local a, b = io.read("*n", "*n")
local taka, ao, sum = a, b, a + b
for i = 2, n do
  a, b = io.read("*n", "*n")
  local next_sum = sum
  if sum % (a + b) ~= 0 then
    next_sum = (a + b) * ((sum // (a + b)) + 1)
  end
  if a < taka then
    if taka % a ~= 0 then
      taka = ((taka // a) + 1) * a
    end
    next_sum = mma(next_sum, (taka // a) * (a + b))
  end
  if b < ao then
    if ao % b ~= 0 then
      ao = ((ao // b) + 1) * b
    end
    next_sum = mma(next_sum, (ao // b) * (a + b))
  end
  sum = next_sum
  taka, ao = a * (sum // (a + b)), b * (sum // (a + b))
  -- print(taka, ao, sum)
end
print(sum)
