n=int(eval(input()))

a=[int(i) for i in input().split()]

ans=[1000,0]

for i in range(1,n):

    if a[i-1]<a[i]:

        ans[0]+=ans[1]*a[i-1]

        ans[1]=0

        ans[1]=ans[0]//a[i-1]

        ans[0]=ans[0]%a[i-1]

    else:

        ans[0]+=ans[1]*a[i-1]

        ans[1]=0

print((ans[0]+ans[1]*a[-1]))

n=int(eval(input()))

a=[int(i) for i in input().split()]

a.append(0)

x,y=1000,0

for i in range(n):

    if a[i]>a[i+1]:

        x+=y*a[i]

        y=0

    else:

        y+=x//a[i]

        x=x%a[i]

print((x+y*a[-2]))
n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = [1000, 0]
for i in range(1, n):
    if a[i - 1] < a[i]:
        ans[0] += ans[1] * a[i - 1]
        ans[1] = 0
        ans[1] = ans[0] // a[i - 1]
        ans[0] = ans[0] % a[i - 1]
    else:
        ans[0] += ans[1] * a[i - 1]
        ans[1] = 0
print((ans[0] + ans[1] * a[-1]))

n = int(eval(input()))
a = [int(i) for i in input().split()]
a.append(0)
x, y = 1000, 0
for i in range(n):
    if a[i] > a[i + 1]:
        x += y * a[i]
        y = 0
    else:
        y += x // a[i]
        x = x % a[i]
print((x + y * a[-2]))

-ans = [1000, 0] -for i in range(1, n): -    if a[i - 1] < a[i]: -        ans[0] += ans[1] * a[i - 1] -        ans[1] = 0 -        ans[1] = ans[0] // a[i - 1] -        ans[0] = ans[0] % a[i - 1] +a.append(0) +x, y = 1000, 0 +for i in range(n): +    if a[i] > a[i + 1]: +        x += y * a[i] +        y = 0 -        ans[0] += ans[1] * a[i - 1] -        ans[1] = 0 -print((ans[0] + ans[1] * a[-1])) +        y += x // a[i] +        x = x % a[i] +print((x + y * a[-2]))