#include<stdio.h>
int main()
{
int n;
int Ai[1000];
int i,sum,min;
while(scanf("%d",&n),n){
sum=0;
min=501;
int flag=1;
for(i=0;i<n;i++){
scanf("%d",&Ai[i]);
sum=sum+Ai[i];
if(Ai[i]<2){
flag=0;
}
if(Ai[i]<min){
min=Ai[i];
}
}
if(flag==1){
printf("%d\n",sum-min+2);
} else{
printf("-1\n");
}
}
}