Option Strict On

Module Module1
    Const n As Int32 = 3
    Dim X, A, B, tmp(n - 1), ans As Long

    Sub Main()
        For i As Int32 = 0 To n - 1
            tmp(i) = CLng(Console.ReadLine())
        Next

        'let'
        X = tmp(0) : A = tmp(1) : B = tmp(2)

        ans = X
        ans -= A
        ans = ans Mod B

        Console.WriteLine(ans)

    End Sub

End Module