#include #include #include #include using namespace std; typedef long long ll; #define max2(a,b) a=max(a,b) int bitDP[1 << 16]; int main() { int n; cin >> n; vectorD(n); for (int i = 0; i < n; i++)cin >> D[i]; bitDP[0] = 100; for (int i = 0; i < (1 << n); i++) { if (bitDP[i] == 0)continue;//へんじがない、ただのしかばねのようだ int maxHP = 100; for (int k = 0; k < n; k++) { if ((i & (1 << k)) && D[k] < 0)maxHP+=100; } for (int k = 0; k < n; k++) { if ((i & (1 << k)) == 0) { if (D[k] > 0) { max2(bitDP[i | (1 << k)], min(maxHP, bitDP[i] + D[k])); } else { max2(bitDP[i | (1 << k)], max(0, bitDP[i] + D[k])); } } } } cout << bitDP[(1 << n) - 1] << endl; return 0; }