#include <bits/stdc++.h>
using namespace std;
const int Max = 1e5 + 5;
int main() {
  int T = 1;
  while (T--) {
    int n, low = 500, high = -1;
    scanf("%d", &n);
    int a;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      low = min(low, a);
      high = max(high, a);
    }
    int ans = (1000 / low) * high + (1000 % low);
    printf("%d", ans);
  }
  return 0;
}
