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 <cstdio>
#include <cstdint>
#include <algorithm>

using namespace std;

FILE* GIn = stdin;
void initInput(const char* filename)
{
	if (filename)
	{
		GIn = fopen(filename, "r");
	}
	if (!GIn)
	{
		GIn = stdin;
	}
}

int main(int argc, const char* argv[])
{
	//initInput("example_succ.txt");
	//initInput("example_fail.txt");

	uint32_t sum = 0;
	uint32_t min_odd = UINT32_MAX;

	uint32_t bills_num;
	fscanf(GIn, "%u", &bills_num);
	for (uint32_t i = 0; i < bills_num; ++i)
	{
		uint32_t bill_value;
		fscanf(GIn, "%u", &bill_value);

		sum += bill_value;
		if (bill_value & 1)
		{
			min_odd = min(min_odd, bill_value);
		}
	}

	if (sum & 1)
	{
		sum -= min_odd;
	}
	if (sum != 0)
	{
		printf("%u\n", sum);
	}
	else
	{
		printf("NIESTETY\n");
	}

	return 0;
}