def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = 1000
    for i in range(n-1):
        m = 1000
        ls = [0 for i in range(n)]
        ls[i] = 1
        l = i
        for j in range(i+1,n):
            if a[j]>a[l]:
                ls[j] = 1
                l = j
            elif a[l]>a[j]:
                ls[j] = -1
                l = j
            else:
                ls[j]=ls[j-1]
                l = j
        cnt = 1000//a[i]
        m = 1000-cnt*a[i]
        for k in range(len(ls)-1):
            if ls[k+1]==1 and ls[k]==-1:
                m = m+cnt*a[k+1]
                cnt = 0
            elif ls[k+1]==-1 and ls[k] == 1:
                m += cnt * a[k]
                cnt = m//a[k+1]
                m = m-cnt*a[k+1]
        if sum(ls)==len(ls):
            cnt = 1000//a[0]
            m = 1000-a[0]*cnt
            m = m + cnt*a[-1]
        if m>ans:
            ans = m
    print(ans)
                

if __name__ == "__main__":
    main()
