using System; using System.Linq; namespace Problem1081 { class Program { static void Main(string[] args) { const long mod = 7 + (long)1e9; int N = GetInt(); var A = GetLongArray(); for(int i = 0; i < N - 1; i++) { var Anext = new long[A.Length - 1]; for(int j = 0; j < Anext.Length; j++) { Anext[j] = (A[j] + A[j + 1]) % mod; } A = Anext; } Console.WriteLine(A[0]); } public static int GetInt() => int.Parse(Console.ReadLine()); public static int[] GetIntArray() => Console.ReadLine().Split().Select(int.Parse).ToArray(); public static double GetDouble() => double.Parse(Console.ReadLine()); public static double[] GetDoubleArray() => Console.ReadLine().Split().Select(double.Parse).ToArray(); public static long GetLong() => long.Parse(Console.ReadLine()); public static long[] GetLongArray() => Console.ReadLine().Split().Select(long.Parse).ToArray(); } }