#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

char str1[100] = {0},str2[100] = {0};
void big_data_multi (char *pstr1, char *pstr2)
{
    int length_str1 = strlen(pstr1);
    int length_str2 = strlen(pstr2);
    int i,j;
    int *pstr3 = (int*)malloc(sizeof(int)*(length_str1+length_str2));
    memset(pstr3, 0, sizeof(int)*(length_str1+length_str2));//一定要初始化，否则乱码
    for( i = 0; i < length_str2; i++)//循环累乘相加
    {
        for(j = 0;  j < length_str1; j++)
        {
            pstr3[i + j + 1] += (pstr1[j] - '0') * (pstr2[i] - '0');
        }
    }
    for ( i = length_str1 + length_str2 - 1; i >= 0; i--)
    {
        if(pstr3[i] >= 10)
        {    
            pstr3[i - 1] += pstr3[i] / 10;
            pstr3[i] = pstr3[i]%10;
        }
    }
     i = 0;
    while (pstr3[i] == 0)
    {
        i++;
    }
    char *pstr4 = (char*)malloc(sizeof(char)*(length_str1 + length_str2 + 1));
     j = 0;
    for(; j < length_str1+length_str2 && i < length_str1+length_str2; j++,i++)
    {
        pstr4[j] = pstr3[i] + '0';
    }
    pstr4[j] = '\0';
    strcpy(str1,pstr4);

}

int main()
{
    int n,flag=0;
	scanf("%d",&n); 
	scanf("%s",str1);
	if(strcmp(str1,"0")==0) flag=1;
	n--;
    while(n--)
    {
        scanf("%s",str2); 
        if(strcmp(str2,"0")==0) flag=1;
        big_data_multi (str1, str2);
    }
    if(flag==1)
    {
    	printf("0");
    	return 0;
    }
    if(strcmp(str1,"1000000000000000000")>0)	printf("-1");
	else printf("%s",str1);
 
}