#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
int n,a[502],sum,i;
while(scanf("%d",&n),n){
sum = 0;
memset(a,0,sizeof(a));
for(i = 0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a,a+n);
if(a[0]<2){
printf("-1\n");
}
else{
for(i = 1;i<n;i++){
sum += a[i];
}
printf("%d\n",2+sum);
}
}
}