Module Module1
  Sub main()
    Dim a As Integer = Console.ReadLine()
    Dim b As Integer = Console.ReadLine()
    Dim c As Integer = Console.ReadLine()
    Dim d As Integer = Console.ReadLine()
    Dim train As Integer
    Dim bus As Integer
    If a < b Then
      train = a
    Else
      train = b
    End If
    If c < d Then
      bus = c
    Else
      bus = d
    End If
    Dim ans As Integer = train + bus
    Console.WriteLine(ans)
  End Sub
End Module