Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim T As Integer = 1
        Dim A As Integer = 1

        For i As Integer = 0 To N - 1
            Dim Ti As Integer = NextInt()
            Dim Ai As Integer = NextInt()
            Dim k As Integer = Math.Max(1 + (T - 1) \ Ti, 1 + (A - 1) \ Ai)
            T = Ti * k
            A = Ai * k
        Next

        WriteLine(T + A)
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module
