#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
 
int main() {
    ll ai, ao, at, aj, al, as, az;
    cin >> ai >> ao >> at >> aj >> al >> as >> az;
    ll res = ao + 2 * (ai / 2) + 2 * (aj / 2) + 2 * (al / 2);
    if(ai >= 1 && aj >= 1 && al >= 1) {
        res = max(res, ao + 3 + 2 * ((ai - 1) / 2) + 2 * ((aj - 1) / 2) + (al - 1) / 2 * 2);
    }
    cout << res << endl;
}
