-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU f [a, b, c, d] = (a * b * c) `mod` d main = print . f . map read . words =<< getLine