open System let No373 () = let IN = Console.ReadLine().Split(' ') |> Array.map Int32.Parse printfn "%d" (IN.[0] * IN.[1] * IN.[2] % IN.[3]) () No373 ()