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
53
54
55
56
#include <iostream>
#include <array>

typedef unsigned uint;

uint n, //ilosc liczb
	a = 0, //bierzaca liczba
	i = 0, //ilosc nieparzystych
	la = 0, //poprzednia nieparzysta
	s = 0, //suma
	r = 0; //reszta
const int size = 1000;

std::array<uint,size> ar;

void procData() {
	ar.fill(0);
	std::cin >> n;
	while (n > 0) {
		n--;
		std::cin >> a;
		if (a % 2 == 0) {
			s += a;
		}
		else {
			ar[a]++;
			if (ar[a] == 2){
				s += 2 * a;
				ar[a] = 0;
			}
		}
	}

	for (int idx = size-1; idx >= 1; idx-=2){
		if (ar[idx] == 1) {
			r += idx;
		}
		if (r % 2 == 0) {
			s += r;
			r = 0;
		}
	}

	if (s != 0) {
		std::cout << s << std::endl;
	}
	else{
		std::cout << "NIESTETY" << std::endl;
	}
}  

int main() {
	std::ios_base::sync_with_stdio(false);
	procData();
	return 0;
}