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