Sub Main(args As String())
        Dim sInput As String() = Split(Console.ReadLine(), " ")

        Dim iInputA As Integer = sInput(0)
        Dim iInputB As Integer = sInput(1)
        Dim iInputC As Integer = sInput(2)
        Dim iInputK As Integer = sInput(3)

        If 2 * 10 ^ 9 >= iInputA AndAlso 2 * 10 ^ 9 >= iInputB AndAlso 2 * 10 ^ 9 >= iInputC Then
            If iInputA >= 0 AndAlso iInputB >= 0 AndAlso iInputC >= 0 Then
                If iInputA + iInputB + iInputC >= iInputK > 0 Then
                    Console.WriteLine(iInputA * 1)
                Else
                    Console.WriteLine("")
                End If
            Else

            End If
        Else
            Console.WriteLine("")
        End If

    End Sub