Module _20190422

    Sub Main()

        Dim sNumber() As Char = Console.ReadLine().ToCharArray

        Dim iMin As Integer = 9999999
        Dim iCalc As Integer

        For i As Integer = 0 To sNumber.Length - 3

            iCalc = 753 - CInt(sNumber(i).ToString & sNumber(i + 1).ToString & sNumber(i + 2).ToString)

            If iCalc < 0 Then

                iCalc = iCalc * -1

            End If

            If iMin > iCalc Then

                iMin = iCalc

            End If

        Next

        Console.WriteLine(iMin)

    End Sub

End Module