#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define aLL(g) (g).begin(),(g).end() #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define F(i,j,k) fill(i[0],i[0]+j*j,k) #define P(p) cout<<(p)< vi; typedef vector vl; typedef vector vd; typedef pair pii; typedef pair pll; typedef long long ll; int dx[] = { 0,1,0,-1 }; int dy[] = { -1,0,1,0 }; int sttoi(std::string str) { int ret; std::stringstream ss; ss << str; ss >> ret; return ret; } bool sort_greater(const pair &a, const pair &b) { return a.second > b.second; } ll permutation(ll n, ll k) { ll ans = 1; for (ll i = 0; i < k; i++) { ans *= n - i; } for (ll i = 0; i < k; i++) { ans /= k - i; } return ans; } void solve() { int h, e, l, o, w, r, d; int sum = 1; int alpha[26]; rep(i, 26) { cin >> alpha[i]; } d = alpha[3]; e = alpha[4]; h = alpha[7]; l = alpha[11]; o = alpha[14]; r = alpha[17]; w = alpha[22]; sum *= permutation(h, 1); sum *= permutation(e, 1); sum *= permutation(w, 1); sum *= permutation(r, 1); sum *= permutation(d, 1); l -= 3; ll maxi = 0; for (int i = 0; i <= l;i++) { maxi = max(maxi, permutation(2 + i, 2)*permutation(1 + l - i, 1)); } sum *= maxi; maxi = 0; o -= 2; for (int i = 0; i <= o;i++){ maxi = max(maxi, permutation(1 + i, 1)*permutation(1 + o - i, 1)); } sum *= maxi; P(sum); } int main() { solve(); return 0; }