//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
#include <numeric>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void a(){
    ll X; cin >> X;
    ll offset = 400;
    for(ll i=8;i>=1;i--,offset+=200){
        if(offset<=X&&X<=offset+199){
           cout << i << endl;
           break; 
        }  
    }
}

bool func (ll A,ll B,ll C, ll K){
    if(K==-1) return false;
    if(B>A&&C>B) return true;
    return max({
            func(A*2,B,C,K-1),
            func(A,B*2,C,K-1),
            func(A,B,C*2,K-1)
        });
}
void b(){
    ll A,B,C; cin >> A >> B >> C;
    ll K; cin >> K;
    if(func(A,B,C,K)){
        cout << "Yes"<<endl;
    }else{
        cout << "No"<<endl;
    }
}

void c(){
    ll N,K; cin >> N >> K;
    auto A = v<>(N,0);
    auto B = v<>(N,0);
    
    cin >> A[0];
    ll cnt=1;

    B[0]=A[0];
    cout << A[0]<<endl;
    
    for(ll i=1;i<N;i++){
        cin >> A[i];
        
        B[i]=B[i-1]*A[i];
        if(cnt<K){
            cnt++;
        }else{
            B[i]/=A[i-K];
        }
    }

    for(ll i=K;i<N;i++){
        if(B[i]>B[i-1]){
            cout << "Yes"<<endl;
        }else{
            cout << "No"<<endl;
        }
    }
    
}

void d(){
    ll N; cin >> N;
    v<> A(N,0); 
    rep(i,N) cin >> A[i];
    v<bool> plus(N,false);
    rep(i,N-1){
        if(A[i]<A[i+1]){
            plus[i+1]=true;
        }else if(A[i]==A[i+1]){
            plus[i+1]=plus[i];
        }
    }
    ll money = 1000;
    ll stock = 0;
    rep(i,N-1){
        if(plus[i]<plus[i+1]){
            stock=money/A[i];
            money%=A[i];
        }else if(plus[i]>plus[i+1]){
            money+=stock*A[i];
            stock=0;
        }

    }
    
    money+=stock*A[N-1];
    stock=0;
    cout << money <<endl;
}
int main(){
    d();
    return 0;
}


Measured memory_bytes: 3628