unittest
{
	assert( [ "2", "1000000000 1000000000" ].parse.expand.solve == 1000000000000000000 );
	assert( [ "3", "101 9901 999999000001" ].parse.expand.solve == -1 );
	assert( [ "31", "4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0" ].parse.expand.solve == 0 );
	
	assert( [ "2", "1000000000000000000 1000000000000000000" ].parse.expand.solve == -1 );		// 追加ケース
}



import std.algorithm;
import std.bigint;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	const L = BigInt( 10L ^^ 18 );
	
	as.sort();
	if( as.front == 0 ) return 0;
	
	auto ans = BigInt( 1 );
	foreach( a; as )
	{
		ans *= a;
		if( L < ans ) return -1;
	}
	return ans.toLong;
}
