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
57
58
59
60
61
62
#include <iostream>
using namespace std;
void quick_sort(long long int* tab,int left,int right)
{
	int i = left, j = right;
	long long int srodek = tab[(i + j) / 2],pom;
	do
	{
		while(tab[i] < srodek) i++;
		while(tab[j] > srodek) j--;
		if(i <= j)
		{
			pom = tab[i];
			tab[i] = tab[j];
			tab[j] = pom;
			i++;
			j--;
		}
	}while(i <= j);
	if(left < j)quick_sort(tab,left,j);
	if(right > i)quick_sort(tab,i,right);
}
int array_sum(long long int* tab,int length)
{
	int sum = 0;
	for(int i=0;i<length;i++)
	{
		sum += tab[i];
	}
	return sum;
}
int find_sum(long long int* tab,int length)
{
	long long int sum = array_sum(tab,length);
	int i = 0;
	do
	{
		if(tab[i]%2 != 0)
		{
			sum -= tab[i];
		}
		i++;
	}while(sum%2 != 0);
	return sum;
}
int main()
{
	int n =0;
	cin>>n;
	long long int* tab = new long long int[n];
	for(int i=0;i<n;i++)
	{
		cin>>tab[i];
	}
	quick_sort(tab,0,n);
	long long int sum = find_sum(tab,n);
	if(sum > 0)
		cout<<find_sum(tab,n);
	else
		cout<<"NIESTETY";
	return 0;
}