#include <bits/stdc++.h>
using namespace std;
namespace std {
template <>
class hash<std::pair<int, int>> {
 public:
  size_t operator()(const std::pair<int, int>& x) const {
    return hash<int>()(x.first) ^ hash<int>()(x.second);
  }
};
}  // namespace std
unordered_map<pair<int, int>, bool> dp[85];
int main() {
  int N;
  cin >> N;
  vector<int> v;
  for (int i = (0); i < (int)(N); i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  dp[0][make_pair(1000, 0)] = true;
  for (int i = (0); i < (int)(N); i++) {
    for (__typeof((dp[i]).begin()) it = (dp[i]).begin(); it != (dp[i]).end();
         ++it) {
      pair<int, int> p = it->first;
      { dp[i + 1][p] = true; }
      {
        int money = p.first;
        int kabu = p.second;
        int cnt = money / v[i];
        int remain = money % v[i];
        dp[i + 1][make_pair(remain, kabu + cnt)] = true;
      }
      {
        int money = p.first;
        int kabu = p.second;
        dp[i + 1][make_pair(money + v[i] * kabu, 0)] = true;
      }
    }
  }
  int ret = 0;
  for (__typeof((dp[N]).begin()) it = (dp[N]).begin(); it != (dp[N]).end();
       ++it) {
    ret = max(ret, (it->first).first);
  }
  cout << ret << endl;
  return 0;
}
