n,*l=list(map(int,open(0).read().split()))

a,c=1000,0

for i in range(n-1):

  s,t=l[i:i+2]

  if s>t: a+=c*s; c=0

  if s<t: c+=a//s; a-=a//s*s

print((a+c*t))
n,*l=list(map(int,open(0).read().split()))

a=1000

for i in range(n-1):

  s,t=l[i:i+2]

  a+=a//s*max(t-s,0)

print(a)
n, *l = list(map(int, open(0).read().split()))
a, c = 1000, 0
for i in range(n - 1):
    s, t = l[i : i + 2]
    if s > t:
        a += c * s
        c = 0
    if s < t:
        c += a // s
        a -= a // s * s
print((a + c * t))

n, *l = list(map(int, open(0).read().split()))
a = 1000
for i in range(n - 1):
    s, t = l[i : i + 2]
    a += a // s * max(t - s, 0)
print(a)

-a, c = 1000, 0 +a = 1000 -    if s > t: -        a += c * s -        c = 0 -    if s < t: -        c += a // s -        a -= a // s * s -print((a + c * t)) +    a += a // s * max(t - s, 0) +print(a)