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: 1716kB
Author: 2018212212307
In contest: 1275

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf = 0x3f3f3f3f;
const int maxn =1e5+10;
int n;
int a[200];
int ans;
int main()
{
	while(~scanf("%d",&n)&&n)
	{
		for(int i=1;i<=n;i++)scanf("%d",&a[i]);
		sort(a+1,a+1+n);
		if(a[1]<2)
		{
			printf("-1\n");
			continue;
		}
		ans=2;
		for(int i=2;i<=n;i++)ans+=a[i];
		printf("%d\n",ans);
	}
}