
def dp(index,mony,count,a,n):
    if index ==n-1:
        ans = mony +a[index]*count
        return ans

    index += 1
    if a[index] <=mony:
        if a[index] < max(a[index:]):
            x = dp(index,mony,count,a,n)
            y =dp(index,mony %a[index],mony // a[index],a,n)
            return max(x,y )
    else:
        return max(dp(index, mony, count, a, n), dp(index,  mony + a[index]*count,0, a, n))

    return mony

if __name__ == '__main__':
    n = int(input())
    a = [int(i) for i in input().split()]
    val = 0
    coun=0
    mony=1000
    print(dp(-1,1000,0,a,n))
