using System; using System.Collections.Generic; using System.Linq; public class Test { public static void Main() { var x = Console.ReadLine() .Split(' ') .Select(n => int.Parse(n)) .ToList(); int ans = (x[0] * x[1] * x[2]) % x[3]; Console.WriteLine(ans); } }