#include #include #include int64_t max(int64_t a, int64_t b) { return (a > b ? a : b); } int64_t min(int64_t a, int64_t b) { return (a < b ? a : b); } int main(void) { int i, j; int N; int64_t D[17]; scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%" PRIi64, &D[i]); } int dp[65536]; for (i = 0; i < 65536; i++) { dp[i] = 0; } dp[0] = 100; for (i = 0; i < (1 << N); i++) { if (0 == dp[i]) { continue; } int64_t s = 100; for (j = 0; j < N; j++) { if (((i >> j) & 1) && D[j] < 0) { s += 100; } } for (j = 0; j < N; j++) { if ((i >> j) & 1) { continue; } int64_t t = i | (1 << j); dp[t] = max(dp[t], min(s, dp[i] + D[j])); } } printf("%" PRIi64 "\n", dp[(1 << N) - 1]); return 0; }