1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include <vector>

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

int main() {
	ios_base::sync_with_stdio(0);

	int n;
	cin >> n;

	int v;

	vector<pair<int, int>> a1, a2;
	vector<pair<int, int>> *c = &a1;
	vector<pair<int, int>> *x = &a2;

	cin >> v;
	(*c).push_back(make_pair(v, 1));


	for (int i = 1; i < n; ++i) {
		x->clear();
		cin >> v;

		int s = 0;
		for (unsigned i = 0; i < c->size(); ++i) {
			if ((*c)[i].first % 2 == 0) {
				s += (*c)[i].second;
			}

			int w = int((((long long) (*c)[i].first) + v) % MOD);
			x->push_back(make_pair(w, (*c)[i].second));
		}
		x->push_back(make_pair(v, s));

		swap(x, c);
	}

	int r = 0;
	for(unsigned i = 0; i < c->size(); ++i){
		if((*c)[i].first % 2 == 0){
			r = (int)((((long long)r) + (*c)[i].second) % MOD);
		}
	}

	cout << r << endl;

	return 0;
}