#include <cstdio>
#include <algorithm>
#include <iostream>
#include<cstring>
#include<cmath>
using namespace std;
bool cmp(int a,int b)
{return a>b;}
int main()
{
int n,k,i,a[505],flag;
while(~scanf("%d",&n))
{
if(n==0)break;
flag=1;k=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]<=1)flag=-1;
}
sort(a,a+n,cmp);
for(i=0;i<n-1;i++)
{
k+=a[i];
}
k+=2;
if(flag==-1)k=-1;
printf("%d\n",k);
}
}