using System; using System.Numerics; using System.Collections.Generic; using System.Collections.Specialized; using System.Formats.Asn1; using System.Globalization; using System.Linq; namespace algorism { class Program { static void Main() { string[] input1 = Console.ReadLine().Split(" "); int N = int.Parse(input1[0]); int A = int.Parse(input1[1]); int B = int.Parse(input1[2]); BigInteger temp = 0; BigInteger factorial = 1; // factorial = (N+1)! for (int i = 1; i <= N + 1; i++) factorial *= i; for (int i = 0; i < N + 1; i++) { BigInteger nanika = BigInteger.Parse(Console.ReadLine()); BigInteger kaijyou = factorial / (i + 1); BigInteger diff = BigInteger.Pow(B, i + 1) - BigInteger.Pow(A, i + 1); temp += diff * nanika * kaijyou; } // ↓ floor除算で切り捨て BigInteger ans = FloorDiv(temp, factorial); Console.WriteLine(ans); } static BigInteger FloorDiv(BigInteger a, BigInteger b) { if (a >= 0) return a / b; else return -(((-a) + b - 1) / b); } } }