a = list(map(int, input().split()))
h = 0
m = 1000
for i in range(n):
    if i==0:
        if a[1]<a[0]:
            h1 = m//a[i]
            h += h1
            m -= a[i] * h1
    elif i==n-1:
        m += a[i] * h
        h = 0
    else:
        if a[i] > a[i-1] :
            m += a[i] * h
            h = 0
        elif a[i] < a[i-1]:
            h1 = m//a[i]
            h += h1
            m -= a[i] * h1

print(m)