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


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

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

  }
