using System; using System.IO; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Numerics; using System.Diagnostics; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using static System.Math; using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions; using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute; using System.Runtime.CompilerServices; static class P { static void Main() { int n = int.Parse(Console.ReadLine().Trim()); var a = Enumerable.Repeat(0, n).Select(_ => int.Parse(Console.ReadLine().Trim())).ToList(); long res = a.First(); long mul = 1; for (int i = 1; i < n; i++) { mul = mul * (n - i) / i; mul %= 1000000007; res += mul * a[i]; res %= 1000000007; //Console.WriteLine(mul); } Console.WriteLine(res); } }