#include <set>
#include <cmath>
#include <functional>

typedef long long ll;
using namespace std;


int main(){
    int n;
    cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ll m = 1000;
    ll k = 0;

    for(int i = 0; i < n; i++){
        if(i == n - 1){
            m += k * a[i];
            break;
        }

        if(i != 0){
            if(a[i - 1] < a[i]) {
                m = k * a[i];
                k = 0;
            }
        } 
        if(i != n - 1) {
            if(a[i] < a[i + 1]) {
                while(m >= a[i]){
                   m -= a[i];
                   k += 1;
                }
            }
        }
    }

    cout << m << endl;
}