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
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n; scanf("%d", &n);
    long long ans = 0;
    vector<int> odd_num;
    for(int i=0; i<n; ++i)
    {
        int a; scanf("%d", &a);
        if(a%2==0) ans+=a;
        else
        {
            odd_num.push_back(a);
            sort(odd_num.begin(), odd_num.end());
            if( odd_num.size()==3)
            {
                ans += odd_num[1] + odd_num[2];
                odd_num.resize(1);
            }
        }
    }
    if(odd_num.size()==2)
        ans+= odd_num[0]+odd_num[1];

    if(ans>0 )printf("%lld", ans);
    else printf("NIESTETY\n");
}