using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace yukikoda { class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(); BigInteger a = BigInteger.Parse(s[0]); BigInteger b = BigInteger.Parse(s[1]); BigInteger c = BigInteger.Parse(s[2]); BigInteger d = BigInteger.Parse(s[3]); Console.WriteLine(a * b * c % d); } } }