import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdlib; void main() { auto N = readln.chomp.to!int; auto A = readln.split.map!(to!long).array; immutable long mod = 10^^9 + 7; foreach_reverse (i; 0..N) { foreach (j; 0..i) { A[j] = (A[j] + A[j+1]) % mod; } } A.front.writeln; }