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
/*
 * @contest Potyczki Algorytmiczne 2015
 * @task 1B Kieszonkowe
 * @taskfile kie.pdf
 * @file kie.cpp
 * @author ksswzza
*/

#include <limits.h>
#include <stdio.h>
#include <stdlib.h>

#define NUM_PRN "%ld"
#define NUM_MAX LONG_MAX
typedef long num_t;


#define log(...) { fprintf(stderr, "[%s %d] ", __FUNCTION__, __LINE__); fprintf(stderr, __VA_ARGS__); }

int main(int argc, char* argv[]) {
    num_t sum = 0;
    num_t n;
    num_t e;
    num_t min_e = NUM_MAX;
    scanf(NUM_PRN, &n);
    for (num_t i = 0; i < n; ++i) {
        scanf(NUM_PRN, &e);
        if ((e % 2) != 0 && e < min_e) {
            min_e = e;
        }
        sum += e;
    }
    if ((sum % 2) != 0) {
        sum -= min_e;
    }
    if (sum == 0) {
        printf("NIESTETY\n");
    } else {
        printf(NUM_PRN "\n", sum);
    }
    return 0;
}