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

int main(){
  int n,asset=1000,share=0;
  scanf("%d",&n);
  int a[n+1]={999};
  for(int i=1;i<=n;++i) scanf("%d",&a[i]);

  for(int i=1;i<=n;++i){
    if((a[i]<a[i-1] && a[i]<=a[i+1]) && i!=n){
      while(asset>=a[i]){
        share++;
        asset-=a[i];
      }
    }else if((a[i]>a[i-1] && a[i]>=a[i+1]) || i==n){
      while(share>0){
        share--;
        asset+=a[i];
      }
    }
  }
  printf("%d\n",asset);
}