#include #include using namespace std; int main() { long long i = 0, n = 0, a = 0, b = 0, sum = 0, now = 0, max, ans = 0, c = 0, d = 0, e = 0, deno = 1, nu = 1; string s; cin >> max; cin.ignore(); getline(cin, s); while (s[i] != '\0') { if (s[i] == ' ') { sum += now; now = 0; a++; } else { now = now * 10 + s[i] - 48; } i++; } sum += now; a++; b = max - sum - a + 1; n = a + b; //cout << n << " "<< a <<" "<< b << endl;) if (b == 0 || sum == 0) { cout << "1" << endl; } else if (b < 0) { cout << "NA" << endl; } else { if (a > b) { c = a; d = b; } else { c = b; d = a; } for (i = 0; i < d; i++) { nu *= (n - i); deno *= (i + 1); } nu %= 1000000007; deno %= 1000000007; e = nu % deno; while (e != 0) { nu += 1000000007; e = nu % deno; } ans = nu / deno; cout << ans << endl; } return 0; }