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
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	std::ios_base::sync_with_stdio(false);

	int count;
	cin >> count;

	vector<int> even, odd;
	even.reserve(count);
	odd.reserve(count);

	for(int n = 0; n < count; n++) {
		int value;
		cin >> value;
		if(value % 2 == 0)
			even.push_back(value);
		else
			odd.push_back(value);
	}

	std::sort(odd.begin(), odd.end(), std::greater<int>());
	if(odd.size() % 2 == 1)
		odd.pop_back();

	int sum = 0;
	for(int n = 0; n < (int)even.size(); n++)
		sum += even[n];
	for(int n = 0; n < (int)odd.size(); n++)
		sum += odd[n];

	if(sum == 0)
		cout << "NIESTETY" << endl;
	else
		cout << sum << endl;

	return 0;
}