fn main() {
    proconio::input! {
        n: usize,
        a: [u64; n],
    }
    let mut r = 1000;
    let mut s = 0;

    for i in 0..n - 1{
        if a[i] < a[i + 1] {
            s = r / a[i];
            r -= s * a[i];
        } else {
            r += s * a[i];
            s = 0;
        }
    }
    r += s * a[n - 1];
    println!("{}", r);
}
