#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ld long double
#define pb push_back
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD= 1e9+7 ;
const ll inf=1e18;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define put(x) cout<<#x<<" = "<<x<<endl;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

ll lcm(ll a,ll b){
    return a*(b/__gcd(a,b));
}

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

bool isVowel(char c){
	if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u')
		return true;
	return false;
}

ll sum(ll k){
	if(k<0)
		return 0;
	return (k * (k+1))/2;
}
template<typename T>
struct FenwickTree
{
	T N;
	vector<int> tree;
 
	void init(int n)
	{
		N = n;
		tree.assign(n + 1, 0);
	}
 
	void update(int idx, T val)
	{
		while (idx <= N)
		{
			tree[idx] += val;
			idx += idx & -idx;
		}
	}
 
	void updateMax(int idx, T val)
	{
		while (idx <= N)
		{
			tree[idx] = max(tree[idx], val);
			idx += idx & -idx;
		}
	}
 
	T pref(int idx)
	{
		T ans = 0;
		while (idx > 0)
		{
			ans += tree[idx];
			idx -= idx & -idx;
		}
		return ans;
	}
 
	T rsum(int l, int r)
	{
		return pref(r) - pref(l - 1);
	}
 
	T prefMax(int idx)
	{
		T ans = -2e9;
		while (idx > 0)
		{
			ans = max(ans, tree[idx]);
			idx -= idx & -idx;
		}
		return ans;
	}
};
//~ const int MAXN = 1e6+10;
//~ std::vector <int> prime;
//~ bool is_composite[MAXN];

//~ void sieve (int n) {
	//~ std::fill (is_composite, is_composite + n, false);
	//~ for (int i = 2; i < n; ++i) {
		//~ if (!is_composite[i]) prime.push_back (i);
		//~ for (int j = 0; j < (int)prime.size () && i * prime[j] < n; ++j) {
			//~ is_composite[i * prime[j]] = true;
			//~ if (i % prime[j] == 0) break;
		//~ }
	//~ }
//~ }

//~ const int sz = 1e5+10;


//~ ll a[sz],pre[sz];
//~ ll n,x;
//~ bool check(ll left, ll right, ll sum){
	//~ while(sum<x and left>=0 and right<=n){
		
	//~ }
	//~ if(sum==x)
		//~ return true;
	//~ return false;
//~ }


int n;
ll a[100];


ll solve(ll val, ll id){
	//~ error(val, id);
	if(id>=n)
		return val;
	ll ans = val;
	for(int i=id+1;i<n;i++){
		if(a[id]<a[i]){
			ll temp = val;
			ll count = temp/a[id];
			temp -= count*a[id];
			temp += count*a[i];
			temp = solve(temp, i+1);
			ans = max(ans, temp);
		}
	}
	ans = max(ans, solve(val, id+1));
	return ans;
}

int main(){
	//~ FILE *fpi,*fpo;
    //~ fpi=freopen("input1F.txt","r+",stdin);
    //~ fpo=freopen("output1F.txt","w+",stdout);
	
	int t;
	t = 1;
	
	//~ cin>>t;
	
	while(t--){
			//~ ll n;
			cin>>n;
			//~ ll a[n];
			for(int i=0;i<n;i++)
				cin>>a[i];
			
			cout<<solve(1000, 0);
	}	
	return 0;
}
