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

int main(){
	int n;
	cin>>n;
	long long *a = new long long[n];
	for(int i=0;i<n;i++) cin>>a[i];
  
	long long amount=1000;
  
	for(int i=0;i<n;i++){
		int j=i+1;
		while(j<n && a[j]>=a[j-1]) j++;
		j--;
		long long diff=a[j]-a[i];
		if(diff<=0){
			i=j;
			continue;
		}
		long long no_buy =curr/a[i];
		long long remain =curr%a[i];
		long long profit =(a[j])*no_buy;
		curr=remain+profit;
		i=j;
	}
	cout<<max(curr,(long long)1000)<<endl;
}