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
                if ls[j-1]==1:
                    ls[j-1]=0
                l = j
            elif a[l]>a[j]:
                ls[j] = -1
                if ls[j-1]==-1:
                    ls[j-1] = 0
                l = j
            else:
                ls[j]=0
                l = j
        cnt = 1000//a[i]
        m = 1000-cnt*a[i]
        for k in range(len(ls)):
            if ls[k]==1:
                m = m+cnt*a[k]
                cnt = 0
            elif ls[k]==-1:
                if 1 not in ls[k+1:]:
                    continue
                cnt = m//a[k]
                m = m-cnt * a[k]
        if m>ans:
            ans = m
    print(ans)
                

if __name__ == "__main__":
    main()
