import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); } sc.close(); for (int i = n - 1; i > 0; i--) { long[] b = new long[n]; for (int j = 0; j < i; j++) { b[j] = a[j] + a[j + 1]; } a = b; } System.out.println(a[0] % 1000000007); } }