N = int(raw_input()) D = map(int,raw_input().split()) bad = 0 for i in xrange(N): if D[i] < 0: bad |= 1 << i dp = [0]*(1 << N) dp[0] = 100 for loop in xrange(N): for i in xrange(N): for bit in xrange(1 << N): beat = bin(bad & bit).count("1") if dp[bit] == 0 or bit & (1 << i): continue if D[i] < 0: dp[bit | 1 << i] = max(dp[bit | 1 << i], dp[bit]+D[i]) else: dp[bit | 1 << i] = max(dp[bit | 1 << i], min(100*(beat+1), dp[bit]+D[i])) print dp[(1 << N)-1]