program main
  implicit none
  integer(8) :: n, i, x, y
  integer(8), allocatable :: a(:), t(:)
  read(*, *) n
  allocate(a(n), t(n))
  do i = 1, n
    read(*, *) t(i), a(i)
  end do
  x = 1
  y = 1
  do i = 1, n
    call update(x, y, t(i), a(i))
  end do
  write(*, "(i0)") x + y
  deallocate(a, t)

  contains

  subroutine update(x, y, t, a)
    implicit none
    integer(8), intent(inout) :: x, y
    integer(8), intent(in) :: t, a
    integer(8) :: ma, mb, mult
    ma = x / t
    if (mod(x, t) > 0) ma = ma + 1
    mb = y / a
    if (mod(y, a) > 0) mb = mb + 1
    mult = max(ma, mb)
    x = t * mult
    y = a * mult
  end subroutine update
end
