#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($( { splits.next().unwrap().parse::<$t>().unwrap() },)*)
    }}
}

#[allow(unused_macros)]
macro_rules! invec {
    ( $ t : ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}

fn dfs(a: &Vec<u64>, day: usize, current_money: u64, current_stock: u64) -> u64 {
    if day == a.len() {
        return current_money;
    }
    return std::cmp::max(dfs(&a, day + 1, current_money, current_stock),
                    std::cmp::max(dfs(&a, day + 1, current_money - a[day] * (current_money / a[day]), current_stock + (current_money / a[day])),
                             dfs(&a, day + 1, current_money + (current_stock * a[day]), 0)));

}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n,) = input!(usize);
    let a = invec!(u64);

    println!("{}", dfs(&a, 0, 1000, 0));
}

fn main() {
    solve();
}
