from functools import lru_cache

def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    
    @lru_cache(None)
    def dp(i, m):
        if i == N-1:
            return m
        else:
            delta = A[i+1] - A[i]
            if delta > 0:
                maxa = m // A[i]
                return max(dp(i+1, m + delta*a) for a in range(maxa+1))
            else:
                return dp(i+1, m)

    print(dp(0, 1000))
 
 
if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()