N = int(input()) D = list(map(int, input().split())) INF = -2000 dp = [0] * (1 << N) dp[0] = 100 X = [100] * (1 << N) K = 0 for i, d in enumerate(D): if d < 0: K |= 1 << i for i in range(1 << N): X[i] += 100 * (i & K).bit_count() for i in range(N): for j in range(N): d = D[j] for k in range(1 << N): if dp[k] <= 0: continue if k & (1 << j) == 0: if d < 0: dp[k | (1 << j)] = max(dp[k | (1 << j)], dp[k] + d, 0) else: dp[k | (1 << j)] = max(dp[k | (1 << j)], min(dp[k] + d, X[k])) print(dp[-1])