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
#include <iostream>

using namespace std;

int main(int argc, char** argv) {

    ios_base::sync_with_stdio(0);
    
    int n, current_number;
    int even_sum = 0, odd_sum = 0, no_odd_numbers = 0, min_odd = 1000000;
    
    cin >> n;
    
    for (int i=0; i<n; i++) {
        cin >> current_number;
        
        if (current_number % 2 == 0) {
            even_sum += current_number;
        } else {
            odd_sum += current_number;
            no_odd_numbers++;
            if (current_number < min_odd) {
                min_odd = current_number;
            }
        }
    }
    
    if (no_odd_numbers == 1 && even_sum == 0) {
        cout << "NIESTETY";
    } else if (no_odd_numbers % 2 == 0) {
        cout << (even_sum + odd_sum);
    } else {
        cout << (even_sum + odd_sum - min_odd);
    }
    
    return 0;
}