#include <iostream> #include <vector> using namespace std; int main(){ int m; cin >> m; int k; int cnt = 0; long long int sum = 0; long long res = 1; while (cin >> k) { if (k == 0) { cout << "1" << endl; return 0; } sum += k; cnt++; } m = m - sum - cnt + 1; if (m < 0) { cout << "NA" << endl; return 0; } else { vector<int> waru; for (int i = 1; i <= cnt; i++) { waru.push_back(i); } for (int i = 1; i <= cnt; i++) { res *= (i + m); for (int j = 0; j < waru.size(); j++) { if (!(res % waru[j])){ res = res / waru[j]; waru.erase(waru.begin() + j); j--; } } cout << i + m << endl; cout << res << endl; if (res > 1000000007) res %= 1000000007; } } cout << res << endl; return 0; }