Module Module1

  

    Sub Main()

        Dim sInput As Integer
        sInput = Console.ReadLine()
        Dim sExpect1000 As Integer = sInput \ 1000
        Dim sExpect5 As Integer = (sInput Mod 1000) \ 5
        Console.WriteLine(sExpect1000 * 1000 + sExpect5 * 5)
    End Sub

End Module
