#55629: C++ 解答


yp11550392@yphs.tp.edu.tw (ZEROJUDGE)


#include <iostream>
using namespace std;

int main() {
    int T, G, W, E, B;
    while (cin >> T >> G >> W >> E >> B) {
        int total = G + W + E + B;
        if (total <= T) {
            cout << total << "\n";
        } else {
            cout << "-1\n";
        }
    }
    return 0;
}

 

//嚴禁抄襲 !