#include<stdio.h>
int main ()
{
    int number,j;
    long long int multi;
    scanf("%d",&number);

    for (j=0; j<number; j++)
    {
        scanf("%lld", &multi);
    }

    multi =  multi*j;
    if (multi>1000000000000000000)
    {
        printf("-1");
    }
    else
    {
        printf("%lld", multi);
    }
    return 0;

}

