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

int main()
{
	int minimumOddNumber = 0;
	int countedCoins = 0;

	int amountOfCoins = 0;
	int tmpValue = 0;
	
	scanf("%d", &amountOfCoins);

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

		countedCoins += tmpValue;
		if (tmpValue % 2 == 1)
		{
			if (minimumOddNumber != 0)
			{
				if (minimumOddNumber > tmpValue)
				{
					minimumOddNumber = tmpValue;
				}
			}
			else
			{
				minimumOddNumber = tmpValue;
			}
		}
	}

	tmpValue = countedCoins - minimumOddNumber;

	if (countedCoins % 2 == 0)
	{
		printf("%d", countedCoins);
	}
	else if (tmpValue <= 0)
	{
		printf("NIESTETY");
	}
	else
	{
		printf("%d", tmpValue);
	}

	return 0;
}