use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [i32;n]
    }
    a.insert(0, std::i32::MAX);
    let mut b = true; // buy or sell
    let mut u = 0; // up or down
    let mut v = Vec::new();
    for i in 1..a.len() {
        if a[i-1] == a[i] {
           continue;
        }
        if a[i-1] > a[i] && u == -1 ||
           a[i-1] < a[i] && u == 1 {
            *v.last_mut().unwrap() = a[i];
        }
        if b && a[i-1] > a[i] {
            b = false;
            u = -1;
            v.push(a[i]);
        }
        if !b && a[i-1] < a[i] {
            b = true;
            u = 1;
            v.push(a[i]);
        }
    }
    // println!("{:?}", v);
    let mut y = 1000;
    let mut k;
    if v.len() < 2{
        println!("{}", y);
        return;
    }
    k = y / v[0];
    y %= v[0];
    for i in 1..v.len() {
        if v[i-1] < v[i] {
            y += k * v[i];
            k = 0;
        } else if v[i-1] > v[i] {
            k = y / v[i];
            y %= v[i];
        }
        // println!("{} {} {}", v[i], y, k);
    }
    println!("{}", y);
}
