1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<iostream>
int main() {
    using namespace std;
    ios_base::sync_with_stdio(0);
    long ileImDam;
    cin >> ileImDam;
    long long suma = 0;
    int banknot, banknot_niepodzielny = 0;

    for (int i = 0; i < ileImDam; i++) {
        cin >> banknot;
        if (banknot % 2 == 0)
            suma += banknot;
        else if (banknot_niepodzielny != 0) {
                suma += banknot_niepodzielny += banknot;
                banknot_niepodzielny = 0;
            } else banknot_niepodzielny = banknot;
    }
    if (suma == 0)
        cout << "NIESTETY" << endl;
    else cout << suma;
}