import java.util.Scanner; public class Main_yukicoder107 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] d = new int[n]; for (int i = 0; i < n; i++) { d[i] = sc.nextInt(); } int[][] dp = new int[n + 1][0x1 << n]; dp[0][0] = 100; for (int i = 0; i < 0x1 << n; i++) { for (int k = 0; k < n; k++) { if (dp[k][i] == 0) { continue; } for (int j = 0; j < n; j++) { if ((i & 0x1 << j) != 0) { continue; } if (d[j] < 0) { dp[k + 1][i | 0x1 << j] = Math.max(dp[k + 1][i | 0x1 << j], dp[k][i] + d[j]); } else { dp[k][i | 0x1 << j] = Math.max(dp[k][i | 0x1 << j], Math.min(100 * (k + 1), dp[k][i] + d[j])); } } } } int max = 0; for (int i = 0; i <= n; i++) { max = Math.max(max, dp[i][(0x1 << n) - 1]); } System.out.println(max); sc.close(); } }