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

int main(){
  int n;
  int money1=1000;
  int money2=1000;
  int count=0;
  cin >> n;
  vector<int> a(300);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(int i=0;i<n-1;i++){
    if(a[i]+<a[i+1]){
      count = money1/a[i];
      money1 -= count*a[i];//買う
    }
    money1 += count*a[i+1];//売る
    count = 0;
  }
    for(int i=0;i<n-1;i++){
    if(a[i]+5<a[i+1]){
      count = money2/a[i];
      money2 -= count*a[i];//買う
    }
    money2 += count*a[i+1];//売る
    count = 0;
  }
  
  cout << max(money1,money2) << endl;
}
      
      
  

