#include #include using namespace std; int main() { long long int m; scanf("%lld", &m); long long int *h = new long long int[m]; long long int i = 0; long long int sum = 0; while (cin >> h[i]) { sum += h[i]; i++; } long long int num = m - sum; num = num - i + 1; if (num < 0) { printf("NA\n"); } else if (num == 0) { printf("1\n"); } else { long long int fact1 = 1, fact2 = 1, fact3 = 1; long long int j = 1; for (j = 1; j <= num + i; j++) { fact1 = fact1 * j; } for (j = 1; j <= i; j++) { fact2 = fact2 * j; } for (j = 1; j <= num; j++) { fact3 = fact3 * j; } printf("%lld\n", (fact1 / (fact2 * fact3)) % 1000000007); } return 0; }