#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n),n)
{
int a[105];
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
sort(a+1,a+1+n);
if(a[1]<2)
printf("-1\n");
else
{
int ans=0;
for(int i=n;i>1;i--)
ans+=a[i];
ans+=2;
cout<<ans<<endl;
}
}
return 0;
}