read N
read An


[ ! "$(echo $An | grep " 0")"  = "" ] && { echo 0; exit; }

res=1
for num in $(echo $An); do
        res=$(($res*$num))
        [ ${#res} -gt 18 ] && [ ! $res -eq 1000000000000000000 ] && { echo -1; exit; }
done
echo $res