#include using namespace std; int main() { int K, N, F, A[1000],beans; cout << "粒の数: "; cin >> K; cout << "袋の数: "; cin >> N; cout << "家族の数: "; cin >> F; for (int i = 0; i < F; i++) { cout << i+1 << "人目の年齢: "; cin >> A[i]; } beans = K * N; for (int i = 0; i < F; i++) { beans -= A[i]; } if (beans < 0) { beans = -1; } cout << beans << endl; return 0; }