#include #include #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) using namespace std; template void setmax(T & a, T const & b) { if (a < b) a = b; } template void setmin(T & a, T const & b) { if (b < a) a = b; } const int inf = 1e9+7; int main() { int n; cin >> n; vector d(n); repeat (i,n) cin >> d[i]; int mask = 0; repeat (i,n) if (d[i] < 0) mask |= 1< dp(1< 0) { setmax(dp[s], dp[t] + d[i]); } } int upper = 100 * (1 + __builtin_popcount(s & mask)); setmin(dp[s], upper); } cout << max(0, dp[(1<