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
#include <stdio.h>
#include <limits.h>

int main()
{
	int n;
	int odd = 0;
	int even = 0;
	int smallest_odd = INT_MAX;
	long long result = 0;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		int tmp;
		scanf("%d", &tmp);

		switch (tmp % 2) {
			case 0:
				result += tmp;
				even++;
				break;
			case 1:
				result += tmp;
				odd++;
				if (tmp < smallest_odd)
					smallest_odd = tmp;
				break;
		}
	}

	if (odd == 1 && even == 0) {
		printf("NIESTETY\n");
		return 0;
	}
	if (odd % 2 != 0)
		result -= smallest_odd;
	printf("%lld\n", result);

	return 0;
}