#include #define REP(i, n) for (int i = 0; i < (n); i++) #define FOR(i, init, n) for (int i = init; i < (n); i++) #define ALL(obj) (obj).begin(), (obj).end() #define fi first #define se second using namespace std; using ll = long long int; using P = pair; using T = tuple; using edge = struct { int to, cost; }; const int MOD = 1e9 + 7; const int iINF = 1e9; const long long int llINF = 1e18; const double PI = acos(-1.0); const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; int dp[1 << 16]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector D(N); vector loc(N); REP(i, N) { cin >> D[i]; if (D[i] < 0) { loc[i] = true; } } dp[0] = 100; REP(S, 1 << N) { int HP = 100; if(dp[S] == 0) continue; REP(i, N) { if(((S >> i) & 1) && loc[i]) { HP += 100; } } REP(i, N) { if ((S >> i) & 1) continue; dp[S | 1 << i] = max(dp[S | 1 << i], (dp[S] + D[i] <= HP ? dp[S] + D[i] : HP)); } } cout << dp[(1 << N) - 1] << endl; return 0; }