import java.util.*; import java.io.*; public class Main { static int n; static int[][][] dp; static int[] monsters; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(br.readLine()); monsters = new int[n]; String[] line = br.readLine().split(" ", n); int m = 0; for (int i = 0; i < n; i++) { monsters[i] = Integer.parseInt(line[i]); if (monsters[i] < 0) { m++; } } dp = new int[n + 1][m + 1][(int)(Math.pow(2, n))]; for (int i = 0; i <= n; i++) { for (int j = 0; j <= m; j++) { Arrays.fill(dp[i][j], -1); } } dp[0][0][0] = 100; System.out.println(dfw(n, m, (int)(Math.pow(2, n)) - 1)); } static int dfw(int idx, int count, int key) { if (idx < 0) { return 0; } if (dp[idx][count][key] != -1) { return dp[idx][count][key]; } int max = 0; for (int i = 0; i < n; i++) { int x = (int)(Math.pow(2, i)); if ((x & key) == 0) { continue; } if (monsters[i] < 0) { int tmp = dfw(idx - 1, count - 1, key ^ x); if (tmp != 0) { max = Math.max(max, Math.max(0, tmp + monsters[i])); } } else { int tmp = dfw(idx - 1, count, key ^ x); if (tmp != 0) { max = Math.max(max, Math.min(100 * (count + 1), tmp + monsters[i])); } } } dp[idx][count][key] = max; return max; } }