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: 6ms
Memory: 1092kB
Author: 2018212212034
In contest: 1275

#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){

	int a;
	while(scanf("%d",&a)&&a!=0){
		int k[100];
		int i,j,t,sum=0,flag=1,max=600;
		for(i=0;i<a;i++){
			scanf("%d",&k[i]);
			sum+=k[i];
			if(k[i]<2)
				flag=-1;
			if(max>k[i])
				max=k[i];
		}
	
	if(flag==-1)
		printf("%d\n",flag);
	else
		printf("%d\n",sum-max+2);
}
}