#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
        a:[i64;n],
    }
    // small -> big の間で繰り返す！
    let mut pairs = vec![];

    let mut small = 9999;
    let mut big = 0;
    for &x in a.iter() {
        if big > x {
            // 入れ替わり
            pairs.push((small, big));
            small = 9999;
            big = 0;
            continue;
        }
        small = min(small, x);
        big = max(big, x);
    }
    if small != 9999 && big != 0 {
        pairs.push((small, big));
    }
    let mut ans = 1000;
    for &(s, b) in pairs.iter() {
        let count = ans / s;
        ans -= s * count;
        ans += b * count;
    }
    println!("{}", ans);
}
