import sys

sys.setrecursionlimit(10**8)

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

def rec(k, ans, money, n):

    x = a[k]
    for i in range(k+1, len(a)):
        if (x < a[i]):   # 買う
            n = money // a[i-1]
            money -= a[i-1] * n
            money += a[i] * n
            rec(i, ans, money, n)

    return ans.append(money)

def main():
    ans = [0]
    money = 1000
    n = 0
  
    rec(0, ans, money, n)
    print(ans)
    print(max(ans))

if __name__ == '__main__':
    main()
