use proconio::input;

fn main() {
    input! {
        n: usize,
        v: [usize; n], // v_1 v_2 ... v_n
    }

    let mut w = vec![v[0]];
    let mut up = 0;
    for i in 0..n-1 {
        if up == 1 {
            if v[i] < v[i+1] {
                if i == n-2 {
                    w.push(v[i+1]);
                }
                continue;
            } else if v[i] == v[i+1] {
                w.push(v[i]);
                up = 0;
            } else {
                w.push(v[i]);
                if i == n-2 {
                    w.push(v[i+1]);
                }
                up = -1;
            }
        } else if up == 0 {
            if v[i] < v[i+1] {
                up = 1;
                if i == n-2 {
                    w.push(v[i+1]);
                }
            } else if v[i] > v[i+1] {
                up = -1;
                if i == n-2 {
                    w.push(v[i+1]);
                }
            }
        } else {
            if v[i] < v[i+1] {
                up = 1;
                w.push(v[i]);
                if i == n-2 {
                    w.push(v[i+1]);
                }
            } else if v[i] == v[i+1] {
                up = 0;
                w.push(v[i]);
            } else {
                if i == n-2 {
                    w.push(v[i+1]);
                }
                continue;
            }
        }
    }


    
    let len = w.len();
    let mut motikabu = 0;
    let mut shojikin = 1000;

    if len == 1 {
        println!("1000")
    } else if w[0] < w[1] {
        motikabu = shojikin / w[0];
        shojikin -= motikabu * w[0];
        let mut last = 1000;
        for i in 1..len {
            if i % 2 == 1 {
                shojikin += w[i]*motikabu;
                motikabu = 0;
                last = shojikin;
            } else {
                motikabu = shojikin / w[i];
                shojikin -= motikabu * w[i];
            }
        }
        if last > shojikin {
            println!("{}",last)
        } else {
            println!("{}",shojikin)
        }
    } else {
        let mut last = 1000;
        for i in 1..len {
            if i % 2 == 0 {
                shojikin += w[i]*motikabu;
                motikabu = 0;
                last = shojikin;
            } else {
                motikabu = shojikin / w[i];
                shojikin -= motikabu * w[i];
            }
        }
        if last > shojikin {
            println!("{}",last)
        } else {
            println!("{}",shojikin)
        }
    }
}
