#include <iostream>

using namespace std;

int main()
{
  int d, s = 0, y = 1000;
  cin >> d;
  
  int i = 2, cur, nxt;
  
  cin >> cur;
  do
  {
    cin >> nxt;
    if (s == 0)
    {
      if (nxt > cur)
      {
        yen -= (s = yen / cur) * cur;
        cur = nxt;
      }
    }
    else
    {
      if (nxt < cur)
      {
        yen += s * cur;
        s = 0;
        cur = nxt;
      }
    }
  }
  while (++i < d);
  
  cin >> cur;
  yen += s * cur;
  cout << yen;
  
  return 0
}