Language: C++

import java.util.*;		
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main{
	static public void main(String args[])throws IOException{
		int tt=1;
		boolean[] prime=new boolean[1000001];
		for(int i=2;i*i<=1000000;i++){
			if(prime[i]==false){
				for(int j=2*i;j<=1000000;j+=i){
					prime[j]=true;
				}
			}
		}
		StringBuilder sb=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++){
			int n=i();
			long[] a=new long[n];
			for(int i=0;i<n;i++){
				a[i]=l();
			}
			a=sort(a);
			long mul=0;
			boolean flag=false;
			for(int i=0;i<n;i++){
				if(i==0){
					mul=a[i];
				}else{
					mul=mul*a[i];
				}
				if(mul>1000000000000000000L || mul<0){
					flag=true;
					break;
				}
				if(mul==0){
					break;
				}
			}
			if(flag){
				pln("-1");
			}else{
				pln(mul+"");
			}
		}
		System.out.print(sb.toString());
	}
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	static ArrayList<ArrayList<Integer>> graph;
	static int mod=998244353;
	static class Pair{
		int x;
		int y;
		int z;
		Pair(int x,int y,int z){
			this.x=x;
			this.y=y;
			this.z=z;
		}
		@Override
            public int hashCode() 
            { 
                final int temp = 14; 
                int ans = 1; 
                ans =x*31+y*13; 
                return ans; 
            } 
       @Override
        public boolean equals(Object o) 
        { 
            if (this == o) { 
                return true; 
            } 
            if (o == null) { 
                return false; 
            } 
            if (this.getClass() != o.getClass()) { 
                return false; 
            } 
            Pair other = (Pair)o; 
            if (this.x != other.x || this.y!=other.y) { 
                return false; 
            } 
            return true; 
        }
	}
	public static long[] sort(long[] a){
		int n=a.length;
		ArrayList<Long> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++){
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++){
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b){
        long result=1;
        while(b>0){
            if (b % 2 != 0){
                result=(result*a)%mod;
                b--;
            } 
            a=(a*a)%mod;
            b /= 2;
        }   
        return result;
    }
	public static long gcd(long a, long b){
        if (a == 0){
            return b;
		}
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b){
		return a*(b/gcd(a,b));
	}
	public static long l(){
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value){
		System.out.println(value);
	}
	public static int i(){
		return in.Int();
	}
	public static String s(){
		return in.String();
	}
}
class InputReader 
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	public InputReader(InputStream stream) {
		this.stream = stream;
	}
	public int read() {
		if (numChars== -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int Int() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public String String() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	} 
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	} 
	public String next() {
		return String();
	} 
	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}
class OutputWriter {
	private final PrintWriter writer;
	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}
	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}
	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}
	public void close() {
		writer.close();
	}
	public void flush() {
		writer.flush();
	}
 }
class IOUtils {
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.Int();
		return array;
	}
} 


Compiler output:
a.cc:62:17: error: stray '@' in program
   62 |                 @Override
      |                 ^
a.cc:70:8: error: stray '@' in program
   70 |        @Override
      |        ^
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.function.Function;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.stream.Collectors;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.math.*;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main{
      | ^~~~~~
a.cc:138:16: error: expected ':' before 'InputStream'
  138 |         private InputStream stream;
      |                ^~~~~~~~~~~~
      |                :
a.cc:138:17: error: 'InputStream' does not name a type
  138 |         private InputStream stream;
      |                 ^~~~~~~~~~~
a.cc:139:16: error: expected ':' before 'byte'
  139 |         private byte[] buf = new byte[1024];
      |                ^~~~~
      |                :
a.cc:139:17: error: 'byte' does not name a type
  139 |         private byte[] buf = new byte[1024];
      |                 ^~~~
a.cc:140:16: error: expected ':' before 'int'
  140 |         private int curChar;
      |                ^~~~
      |                :
a.cc:141:16: error: expected ':' before 'int'
  141 |         private int numChars;
      |                ^~~~
      |                :
a.cc:142:16: error: expected ':' before 'SpaceCharFilter'
  142 |         private SpaceCharFilter filter;
      |                ^~~~~~~~~~~~~~~~
      |                :
a.cc:142:17: error: 'SpaceCharFilter' does not name a type
  142 |         private SpaceCharFilter filter;
      |                 ^~~~~~~~~~~~~~~
a.cc:143:15: error: expected ':' before 'InputReader'
  143 |         public InputReader(InputStream stream) {
      |               ^~~~~~~~~~~~
      |               :
a.cc:143:39: error: expected ')' before 'stream'
  143 |         public InputReader(InputStream stream) {
      |                           ~           ^~~~~~~
      |                                       )
a.cc:146:15: error: expected ':' before 'int'
  146 |         public int read() {
      |               ^~~~
      |               :
a.cc:161:15: error: expected ':' before 'int'
  161 |         public int Int() {
      |               ^~~~
      |               :
a.cc:180:15: error: expected ':' before 'String'
  180 |         public String String() {
      |               ^~~~~~~
      |               :
a.cc:180:16: error: 'String' does not name a type
  180 |         public String String() {
      |                ^~~~~~
a.cc:191:15: error: expected ':' before 'boolean'
  191 |         public boolean isSpaceChar(int c) {
      |               ^~~~~~~~
      |               :
a.cc:191:16: error: 'boolean' does not name a type; did you mean 'bool'?
  191 |         public boolean isSpaceChar(int c) {
      |                ^~~~~~~
      |                bool
a.cc:196:15: error: expected ':' before 'String'
  196 |         public String next() {
      |               ^~~~~~~
      |               :
a.cc:196:16: error: 'String' does not name a type
  196 |         public String next() {
      |                ^~~~~~
a.cc:199:15: error: expected ':' before 'interface'
  199 |         public interface SpaceCharFilter {
      |               ^~~~~~~~~~
      |               :
a.cc:199:16: error: 'interface' does not name a type
  199 |         public interface SpaceCharFilter {
      |                ^~~~~~~~~
a.cc:202:2: error: expected ';' after class definition
  202 | }
      |  ^
      |  ;
a.cc: In member function 'int InputReader::read()':
a.cc:148:35: error: expected type-specifier before 'InputMismatchException'
  148 |                         throw new InputMismatchException();
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
a.cc:152:44: error: 'stream' was not declared in this scope
  152 |                                 numChars = stream.read(buf);
      |                                            ^~~~~~
a.cc:152:56: error: 'buf' was not declared in this scope
  152 |                                 numChars = stream.read(buf);
      |                                                        ^~~
a.cc:153:34: error: 'IOException' does not name a type
  153 |                         } catch (IOException e) {
      |                                  ^~~~~~~~~~~
a.cc:154:43: error: expected type-specifier before 'InputMismatchException'
  154 |                                 throw new InputMismatchException();
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
a.cc:159:24: error: 'buf' was not declared in this scope
  159 |                 return buf[curChar++];
      |                        ^~~
a.cc: In member function 'int InputReader::Int()':
a.cc:163:24: error: 'isSpaceChar' was not declared in this scope
  163 |                 while (isSpaceChar(c))
      |                        ^~~~~~~~~~~
a.cc:173:43: error: expected type-specifier before 'InputMismatchException'
  173 |                                 throw new InputMismatchException();
      |                                           ^~~~~~~~~~~~~~~~~~~~~~
a.cc:177:27: error: 'isSpaceChar' was not declared in this scope
  177 |                 } while (!isSpaceChar(c));
      |                           ^~~~~~~~~~~
a.cc: At global scope:
a.cc:204:16: error: expected ':' before 'final'
  204 |         private final PrintWriter writer;
      |                ^~~~~~
      |                :
a.cc:204:17: error: 'final' does not name a type
  204 |         private final PrintWriter writer;
      |                 ^~~~~
a.cc:205:15: error: expected ':' before 'OutputWriter'
  205 |         public OutputWriter(OutputStream outputStream) {
      |               ^~~~~~~~~~~~~
      |               :
a.cc:205:41: error: expected ')' before 'outputStream'
  205 |         public OutputWriter(OutputStream outputStream) {
      |                            ~            ^~~~~~~~~~~~~
      |                                         )
a.cc:208:15: error: expected ':' before 'OutputWriter'
  208 |         public OutputWriter(Writer writer) {
      |               ^~~~~~~~~~~~~
      |               :
a.cc:208:35: error: expected ')' before 'writer'
  208 |         public OutputWriter(Writer writer) {
      |                            ~      ^~~~~~~
      |                                   )
a.cc:211:15: error: expected ':' before 'void'
  211 |         public void print(Object...objects) {
      |               ^~~~~
      |               :
a.cc:211:27: error: 'Object' has not been declared
  211 |         public void print(Object...objects) {
      |                           ^~~~~~
a.cc:211:36: error: expansion pattern 'int' contains no parameter packs
  211 |         public void print(Object...objects) {
      |                                    ^~~~~~~
a.cc:218:15: error: expected ':' before 'void'
  218 |         public void printLine(Object...objects) {
      |               ^~~~~
      |               :
a.cc:218:31: error: 'Object' has not been declared
  218 |         public void printLine(Object...objects) {
      |                               ^~~~~~
a.cc:218:40: error: expansion pattern 'int' contains no parameter packs
  218 |         public void printLine(Object...objects) {
      |                                        ^~~~~~~
a.cc:222:15: error: expected ':' before 'void'
  222 |         public void close() {
      |               ^~~~~
      |               :
a.cc:225:15: error: expected ':' before 'void'
  225 |         public void flush() {
      |               ^~~~~
      |               :
a.cc:228:3: error: expected ';' after class definition
  228 |  }
      |   ^
      |   ;
a.cc: In member function 'void OutputWriter::print(...)':
a.cc:212:37: error: 'objects' was not declared in this scope
  212 |                 for (int i = 0; i < objects.length; i++) {
      |                                     ^~~~~~~
a.cc:214:33: error: 'writer' was not declared in this scope
  214 |                                 writer.print(' ');
      |                                 ^~~~~~
a.cc:215:25: error: 'writer' was not declared in this scope
  215 |                         writer.print(objects[i]);
      |                         ^~~~~~
a.cc: In member function 'void OutputWriter::printLine(...)':
a.cc:219:23: error: 'objects' was not declared in this scope
  219 |                 print(objects);
      |                       ^~~~~~~
a.cc:220:17: error: 'writer' was not declared in this scope
  220 |                 writer.println();
      |                 ^~~~~~
a.cc: In member function 'void OutputWriter::close()':
a.cc:223:17: error: 'writer' was not declared in this scope
  223 |                 writer.close();
      |                 ^~~~~~
a.cc: In member function 'void OutputWriter::flush()':
a.cc:226:17: error: 'writer' was not declared in this scope
  226 |                 writer.flush();
      |                 ^~~~~~
a.cc: At global scope:
a.cc:230:15: error: expected ':' before 'static'
  230 |         public static int[] readIntArray(InputReader in, int size) {
      |               ^~~~~~~
      |               :
a.cc:230:26: error: expected unqualified-id before '[' token
  230 |         public static int[] readIntArray(InputReader in, int size) {
      |                          ^
a.cc:236:2: error: expected ';' after class definition
  236 | }
      |  ^
      |  ;