#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,n) for(int i = 0;i=0;i--) #define ALL(a) a.begin(),a.end() template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef long long ll; typedef long double ld; const ll mod = 1e9 + 7; const ll MOD = 998244353; int main() { int n; cin >> n; vector d(n),dp(1<> d[i]; dp[0] = 100; rep(bit, 1 << n) { int cnt = 1; if (dp[bit] == 0)continue; rep(i, n) if (((bit >> i) & 1)&&(d[i]<0))cnt++; rep(i, n) { if (!((bit >> i) & 1)) { if (dp[bit] + d[i] <= 0)continue; chmax(dp[bit | (1 << i)], min(dp[bit] + d[i],cnt*100)); } } }cout << dp[(1 << n) - 1] << endl; }