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;
    cin >> n;
    vector<int> values;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        values.push_back(tmp);
    }
    if (n == 1 && values[0] % 2 == 1) {
        cout << "NIESTETY\n";
        return 0;
    }
    int sum = accumulate(values.begin(), values.end(), 0);
    if (sum % 2 == 0) {
        cout << sum << "\n";
        return 0;
    }
    int mn = 1001;
    for (auto i : values) {
        if (i % 2 == 1) {
            mn = min(mn, i);
        }
    }
    cout << sum - mn << "\n";
}