use proconio::input;
use std::cmp::max;

fn main() {
    input!{
        n:usize,
        a:[i64;n]
    };

    let mut dp = vec![0;n+1];

    dp[0] = 1000;

    for i in 0..n {
        for j in 0..i {
            let v = a[j..(i+1)].iter().min().unwrap();
            let rest = dp[j]%v;
            let profit = dp[j]/v*a[i];
            dp[i+1] = max(dp[i+1],rest+profit);
        }
    }

    println!("{}",dp[n]);
}

