#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int n;
while(scanf("%d",&n),n) {
int a[105];
int flag = 0;
int iRet = 0;
for(int i=0; i<n; i++) {
scanf("%d",&a[i]);
if(a[i] < 2) flag = -1;
}
if(flag == -1) {
printf("-1\n");
continue;
}
if(flag == 0) {
if(n == 1) printf("2\n");
if(n > 1) {
sort(a,a+n);
for(int i=1; i<n; i++) {
iRet += a[i];
}
iRet += 2;
printf("%d\n",iRet);
}
}
}
return 0;
}