$money = 1000;
$buy = 0;
chomp($n = <>);
chomp($line = <>);
@kabu = split(/ /, $line);

for $i (0 .. $n - 2){
	next if($kabu[$i] > $kabu[$i + 1]);
	if($kabu[$i] == $kabu[$i + 1]){
		if($buy != 0){
			$money += $buy * $kabu[$i];
			$buy = 0;
		}
	}else{
		$now = int($money / $kabu[$i]);
		$buy += $now;
		$money -= $now * $kabu[$i];
	}
}

$money += $kabu[$#kabu] * $buy;

print "$money\n";
