console.log((args=>{
  const [[N],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  let t = 0, c = 1000, s = 0, max = 1000;
  for ( let i = 1; i < N; i++ ) {
    t = A[i] - A[i-1];
    if ( t > 0 ) {
      s += Math.floor( c / A[i-1] );
      c = c % A[i-1];
    } else if ( t < 0 ) {
      c += s * A[i-1];
      s = 0;
      if ( max < c ) max = c;
    }
  }
  return Math.max(max,c+s*A[N-1]);
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
