#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll i, o, t, j, l, s, z;
    cin >> i >> o >> t >> j >> l >> s >> z;
    ll ans = 0;
    for (int m = 0; m <= min({1LL, i, j, l}); m++) { ans = max(ans, (i - m) / 2 * 2 + (j - m) / 2 * 2 + (l - m) / 2 * 2 + m * 3); }
    cout << ans + o << endl;

    return 0;
}
