#[derive(Debug)]
pub struct BinaryHeap<T : Ord> {
    src : Vec<T>,
    n : usize
}

impl<T : Ord> BinaryHeap<T> {
    pub fn new() -> Self {
        Self{ src : vec![], n : 0 }
    }

    pub fn from_vec(v : Vec<T>) -> Self {
        let len = v.len();
        let mut heap = Self{ src : v, n : len };

        for i in (0..(len/2)).rev() {
            heap.trickle_down(i);
        }

        return heap;
    }

    pub fn into_vec(self) -> Vec<T> {
        self.src
    }

    fn left(idx : usize) -> usize {
        (idx << 1) + 1
    }
    fn right(idx : usize) -> usize {
        (idx << 1) + 2
    }
    fn parent(idx : usize) -> usize {
        (idx - 1) >> 1
    }

    pub fn is_empty(&self) -> bool {
        self.n == 0
    }

    fn bubble_up(&mut self) {
        if self.n == 0 {
            unreachable!();
        }
        if self.n == 1 {
            return;
        }

        let mut i = self.n - 1;
        let mut p = Self::parent(i);

        while i > 0 && self.src[i] < self.src[p] {
            self.src.swap(i, p);
            i = p;

            if p != 0 {
                p = Self::parent(p);
            }
        }
    }

    pub fn insert(&mut self, x : T) {
        self.src.push(x);
        self.n += 1;

        self.bubble_up();
    }

    fn trickle_down(&mut self, i : usize) {
        let mut i = i;
        while Self::left(i) < self.n {
            let l = Self::left(i);
            let r = Self::right(i);

            if r >= self.n {
                if self.src[i] > self.src[l] {
                    self.src.swap(i, l);
                }

                break;
            }

            if self.src[l] < self.src[r] {
                if self.src[i] > self.src[l] {
                    self.src.swap(i, l);
                    i = l;
                }
                else {
                    break;
                }
            }
            else {
                if self.src[i] > self.src[r] {
                    self.src.swap(i, r);
                    i = r;
                }
                else {
                    break;
                }
            }
        }
    }

    pub fn pop(&mut self) -> Option<T> {
        if self.is_empty() {
            return None;
        }

        self.src.swap(self.n - 1, 0);

        let x = self.src.pop();

        self.n -= 1;

        self.trickle_down(0);

        x
    }
}

pub fn heap_sort<T : Ord>(arr : Vec<T>) -> Vec<T> {
    let mut sorted = Vec::with_capacity(arr.len());
    let mut heap = BinaryHeap::from_vec(arr);
    while !heap.is_empty() {
        sorted.push(heap.pop().unwrap());
    }

    sorted
}

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
	input!{n:usize, a:[u64;n]};
 	let a = heap_sort(a);
	
  	if a[0] == 0 {
    	println!("0");
      	return;
  	}
  
  	let ans = a.into_iter().fold(1u64, |s, a| s.saturating_mul(a));
 
    if ans > 10u64.pow(18) {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 5620