import java.util.Scanner;

public class Main {
    static final long MX = 1000000000000000000L;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static final long MX = 1000000000000000000L;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    }
} Main static final long MX = 1000000000000000000L; MX 1000000000000000000L public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in long a[] = new long[n]; a new long[n] n for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = in.nextLong();
        } {
            a[i] = in.nextLong();
        } a[i] = in.nextLong() a[i] a i in.nextLong() in.nextLong in long sum = 1; sum 1 boolean zero = false; zero false boolean over = false; over false for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        } {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        } if (a[i] == 0) {
                zero = true;
                break;
            } a[i] == 0 a[i] a i 0 {
                zero = true;
                break;
            } zero = true zero true break; try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            } catch (ArithmeticException e) {
                over = true;
            } ArithmeticException e {
                over = true;
            } over = true over true {
                Math.multiplyExact(sum, a[i]);
            } Math.multiplyExact(sum, a[i]) Math.multiplyExact Math sum a[i] a i if (!over) {
                sum *= a[i];
            } !over over {
                sum *= a[i];
            } sum *= a[i] sum a[i] a i if (sum > MX) {
                over = true;
            } sum > MX sum MX {
                over = true;
            } over = true over true if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        } zero {
            System.out.println(0);
        } System.out.println(0) System.out.println System.out System System.out 0 if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        } over {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 {
            System.out.println(sum);
        } System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    static final long MX = 1000000000000000000L;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    }
} public class Main {
    static final long MX = 1000000000000000000L;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    static final long MX = 1000000000000000000L;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        long a[] = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }

        long sum = 1;
        boolean zero = false;
        boolean over = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0) {
                zero = true;
                break;
            }

            try {
                Math.multiplyExact(sum, a[i]);
            } catch (ArithmeticException e) {
                over = true;
            }

            if (!over) {
                sum *= a[i];
            }

            if (sum > MX) {
                over = true;
            }
        }

        if (zero) {
            System.out.println(0);
        } else if (over) {
            System.out.println(-1);
        } else {
            System.out.println(sum);
        }
    }
}
