Module Module1

    Sub main()
        Dim userInput As String
        Dim result As String

        Const OSATSU As Integer = 1000


        ' データの入力
        userInput = Console.ReadLine()
        result = CInt(userInput) Mod OSATSU

        ' 処理結果を返す
        Console.WriteLine(result)
    End Sub
End Module