import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - 1 - i; j++) { arr[j] += arr[j + 1]; arr[j] %= MOD; } } System.out.println(arr[0]); } }