
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define sz(a)       (ll)(a.size())
#define cr(P)       cout<<P<<"\n";return;
#define mem(a,val)  memset(a, val, sizeof(a))
#define fr(i,x,n)   for(ll i=x; i<n; i++)
#define frr(i,x,n)  for(ll i=n-1; i>=x; i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;



void solve(){

 ll x=0, y=0, c = 0, ans = 1000;
 ll n, m, k;

 cin >> n;
 ll a[n], b[n] = {n};
 stack<ll>s;
 for (ll i = 0; i < n; ++i){
 	cin >> a[i];
 	if(s.empty() or a[s.top()] > a[i]){
 		s.push(i);
 		continue;
 	}
 	while(!s.empty() and a[s.top()] < a[i]){
 		b[s.top()] = i; 
 		s.pop();
 	}
 	s.push(i);
 }
 for (ll i = 0; i < n; ++i){
    x = mod;
    y = b[i];
 	while(i < y){
     x = min(x,a[i]);   
     i++;
 	}
 	if(i == n)
 		break;
 	ans =  (ans/ x) * a[i] + ans % x;
 	if(x!=mod)
 		i--;
 }
 cout << ans << '\n';

 
}

signed main(){
     
 ios_base::sync_with_stdio(false);   
 cin.tie(NULL);
 //int T;cin >> T;while (T--)
 solve();
 return 0;
}

