#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main()
{
    ll a1,a2,a3,a4,a5,a6,a7,k;
    cin>>a1>>a2>>a3>>a4>>a5>>a6>>a7;
    ll p=min(a1,min(a4,a5)),x=a2+a1/2*2+a4/2*2+a5/2*2;
    if(!p)
        cout<<x<<endl;
    else
        cout<<max(x,max(a2+(p-1)*3+(a1-p+1)/2*2+(a4-p+1)/2*2+(a5-p+1)/2*2,a2+p*3+(a1-p)/2*2+(a4-p)/2*2+(a5-p)/2*2))<<endl;
    return 0;
}