#include <iostream>
#define LL long long
using namespace std;

LL aI,aO,aT,aJ,aL,aS,aZ;

int main(){
    cin >> aI >> aO >> aT >> aJ >> aL >> aS >> aZ;

    LL res=2*((aI/2)+(aJ/2)+(aL/2));
    if (aI>0 && aJ>0 && aL>0)
        res=max(res,2*(((aI-1)/2)+((aJ-1)/2)+((aL-1)/2))+3);



    cout << aO+res << "\n";
    return 0;
}
