Start: Jun, 27, 2019 08:30:00
2019年度暑期短学期第二天
End: Jun, 27, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 7ms
Memory: 1712kB
Author: 2018212212048
In contest: 1275

#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
	int n;
	while(cin>>n,n){
		int min,t,sum;
		cin>>min;
		sum=min;
		for(int i=2;i<=n;i++){
			cin>>t;
			sum+=t;
			min=t<min?t:min;
		}
		if(min<2) cout<<-1<<endl;
		else cout<<sum-min+2<<endl;
	}
}