import itertools
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_compact = []
    sabun = []
    for i in range(1, n):
        sabun.append(a[i] - a[i-1])
    for i, kabuka in enumerate(a):
        if i == 0:
            a_compact.append(kabuka)
        elif i == len(a)-1:
            if a[-2] != a[-1]:
                a_compact.append(kabuka)
        else:
            if sabun[i-1] != 0:
                check = sabun[i-1] * sabun[i]
                if check <= 0:
                    a_compact.append(kabuka)
    sabun_compact = []

    for i in range(1, len(a_compact)):
        sabun_compact.append(a_compact[i] - a_compact[i-1])
    money = 1000
    kabu = 0
    for i, s in enumerate(sabun_compact):
        # print(i)
        # print('money' + str(money))
        # print('kabunum' + str(kabu))
        if s > 0:
            kabu = money//a_compact[i]
            money -= a_compact[i]*kabu
        else:
            money += a_compact[i]*kabu
            kabu = 0
    money += a_compact[-1]*kabu
    print(money)
if __name__ == '__main__':
    main()