unittest
{
	assert( [ "4", "3 4 3 2" ].parse.expand.solve == "6 8" );
	assert( [ "5", "3 4 100 3 2" ].parse.expand.solve == "-1" );
	assert( [ "10", "2 2 2 2 2 2 2 2 2 2" ].parse.expand.solve == "2 3" );
	
	assert( [ "4", "2 5 3 2" ].parse.expand.solve == "6 9" );		// 追加ケース
}



import std.conv;
import std.format;
import std.math;
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 )
{
	auto mi = 2L;
	auto ma = 2L;
	foreach_reverse( a; as )
	{
		auto di = cast( long )( a * ( cast( float ) mi / a ).ceil );
		auto da = cast( long )( a * ( cast( float ) ma / a ).floor + a - 1 );
		if( da < mi || ma < di ) return "-1";
		mi = di;
		ma = da;
	}
	return format( "%s %s", mi, ma );
}
