import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    }
} import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {

    private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    }
} Main private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L); THRESHOLD_VALUE BigInteger.valueOf(1000000000000000000L) BigInteger.valueOf BigInteger 1000000000000000000L public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = Integer.parseInt(scanner.next()); N Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner long[] a = new long[N]; a new long[N] N for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        } {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        } long num = Long.parseLong(scanner.next()); num Long.parseLong(scanner.next()) Long.parseLong Long scanner.next() scanner.next scanner if (num == 0) {
                System.out.println("0");
                return;
            } num == 0 num 0 {
                System.out.println("0");
                return;
            } System.out.println("0") System.out.println System.out System System.out "0" return; a[i] = num a[i] a i num BigInteger ans = BigInteger.ONE; ans BigInteger.ONE BigInteger BigInteger.ONE for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        } long num a {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        } {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        } ans = ans.multiply(BigInteger.valueOf(num)) ans ans.multiply(BigInteger.valueOf(num)) ans.multiply ans BigInteger.valueOf(num) BigInteger.valueOf BigInteger num if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            } ans.compareTo(THRESHOLD_VALUE) > 0 ans.compareTo(THRESHOLD_VALUE) ans.compareTo ans THRESHOLD_VALUE 0 {
                System.out.println("-1");
                return;
            } System.out.println("-1") System.out.println System.out System System.out "-1" return; System.out.println(ans.toString()) System.out.println System.out System System.out ans.toString() ans.toString ans String[] args args public class Main {

    private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    }
} public class Main {

    private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    }
} Main
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    private static BigInteger THRESHOLD_VALUE = BigInteger.valueOf(1000000000000000000L);

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        // 取得と同時に乗算をすると閾値が超えた後に 0 が来た場合に WA になるため、保持する
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            long num = Long.parseLong(scanner.next());
            if (num == 0) {
                System.out.println("0");
                return;
            }
            a[i] = num;
        }

        BigInteger ans = BigInteger.ONE;
        for (long num : a) {
            ans = ans.multiply(BigInteger.valueOf(num));

            if (ans.compareTo(THRESHOLD_VALUE) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(ans.toString());
    }
}
