unittest
{
	assert( [ "7", "100 130 130 130 115 115 150" ].solve == 1685 );
	assert( [ "6", "200 180 160 140 120 100" ].solve == 1000 );
	assert( [ "2", "157 193" ].solve == 1216 );
}



import std.conv;
import std.range;
import std.stdio;

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

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	
	auto ans = 1000L;
	auto k = 0L;
	foreach( i; 0L .. as.length.signed - 1 )
	{
		if( as[ i ] < as[ i + 1 ] )
		{
			k += ans / as[ i ];
			ans %= as[ i ];
		}
		else
		{
			ans += k * as[ i ];
			k = 0;
		}
	}
	ans += k * as[ $ - 1 ];
	return ans;
}
