Module Module1
 
    Sub Main()
        Dim a, b, x As Integer
        x = Console.ReadLine
        a = Console.ReadLine
        b = Console.ReadLine
        Console.WriteLine((x - a) Mod b)
        Console.ReadLine()
 
    End Sub
 
End Module