using System; using System.Numerics; public class Hello { public static void Main() { var m = int.Parse(Console.ReadLine().Trim()); var a = (2017 * 2017); var b = 2017; var c = 523; BigInteger ans = BigInteger.ModPow(a, b, c); var d = (2017 + (int)ans) % c; Console.WriteLine(d); } }