#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define ll long long
#define MAXN 100000
#define ll long long
using namespace std;


bool M[2][1000];

int Solve(int pos, int I, int O, int T, int J, int L, int S, int Z) {
    
    if (M[0][pos] && M[1][pos]) {
        return Solve(pos+1,I,O,T,J,L,S,Z);
    }
    
    bool ok=true;
    for(int i=0;i<2;i++)
        for(int j=0;j<3;j++)
            if (M[i][pos+j])
                ok=false;
    
    int answer=0;
    if (ok) {
        answer=max(answer, pos);
    }
    
    // M[0][pos]..M[0][pos+3],
    // M[1][pos]..M[1][pos+3].
    
    if (I>0) {
        for(int k=0;k<=2;k++) {
            if (!M[k][pos] && !M[k][pos+1] && !M[k][pos+2] && !M[k][pos+3]) {
                M[k][pos]=M[k][pos+1]=M[k][pos+2]=M[k][pos+3]=true;
                answer=max(answer,Solve(pos, I-1,O,T,J,L,S,Z));
                M[k][pos]=M[k][pos+1]=M[k][pos+2]=M[k][pos+3]=false;
            }
        }
    }
    
    if (O>0) {
        if (!M[0][pos] && !M[1][pos] && !M[0][pos+1] && !M[1][pos+1]) {
            M[0][pos]=M[1][pos]=M[0][pos+1]=M[1][pos+1]=true;
            answer=max(answer,Solve(pos, I,O-1,T,J,L,S,Z));
            M[0][pos]=M[1][pos]=M[0][pos+1]=M[1][pos+1]=false;
        }
    }
    
    if (T>0) {
        if (!M[0][pos] && !M[0][pos+1] && !M[0][pos+2] && !M[1][pos+1]) {
            M[0][pos]=M[0][pos+1]=M[0][pos+2]=M[1][pos+1]=true;
            answer=max(answer,Solve(pos, I,O,T-1,J,L,S,Z));
            M[0][pos]=M[0][pos+1]=M[0][pos+2]=M[1][pos+1]=false;
        }
        
        if (!M[1][pos] && !M[1][pos+1] && !M[1][pos+2] && !M[0][pos+1]) {
            M[1][pos]=M[1][pos+1]=M[1][pos+2]=M[0][pos+1]=true;
            answer=max(answer,Solve(pos, I,O,T-1,J,L,S,Z));
            M[1][pos]=M[1][pos+1]=M[1][pos+2]=M[0][pos+1]=false;
        }
        
    }
    
    
    if (J>0) {
        if (!M[0][pos] && !M[0][pos+1] && !M[0][pos+2] && !M[1][pos+2]) {
            M[0][pos]=M[0][pos+1]=M[0][pos+2]=M[1][pos+2]=true;
            answer=max(answer,Solve(pos, I,O,T,J-1,L,S,Z));
            M[0][pos]=M[0][pos+1]=M[0][pos+2]=M[1][pos+2]=false;
        }
        
        if (!M[1][pos] && !M[1][pos+1] && !M[1][pos+2] && !M[0][pos]) {
            M[1][pos]=M[1][pos+1]=M[1][pos+2]=M[0][pos]=true;
            answer=max(answer,Solve(pos, I,O,T,J-1,L,S,Z));
            M[1][pos]=M[1][pos+1]=M[1][pos+2]=M[0][pos]=false;
        }
        
    }
    
    
    if (L>0) {
        if (!M[1][pos] && !M[1][pos+1] && !M[1][pos+2] && !M[0][pos+2]) {
            M[1][pos]=M[1][pos+1]=M[1][pos+2]=M[0][pos+2]=true;
            answer=max(answer,Solve(pos, I,O,T,J,L-1,S,Z));
            M[1][pos]=M[1][pos+1]=M[1][pos+2]=M[0][pos+2]=false;
        }
        
        if (!M[0][pos] && !M[0][pos+1] && !M[0][pos+2] && !M[1][pos]) {
            M[0][pos]=M[0][pos+1]=M[0][pos+2]=M[1][pos]=true;
            answer=max(answer,Solve(pos, I,O,T,J,L-1,S,Z));
            M[0][pos]=M[0][pos+1]=M[0][pos+2]=M[1][pos]=false;
        }
        
    }
    
    
    if (S>0) {
        if (!M[1][pos] && !M[1][pos+1] && !M[0][pos+1] && !M[0][pos+2]) {
            M[1][pos]=M[1][pos+1]=M[0][pos+1]=M[0][pos+2]=true;
            answer=max(answer,Solve(pos, I,O,T,J,L,S-1,Z));
            M[1][pos]=M[1][pos+1]=M[0][pos+1]=M[0][pos+2]=false;
        }
    }
    
    
    if (Z>0) {
        if (!M[0][pos] && !M[0][pos+1] && !M[1][pos+1] && !M[1][pos+2]) {
            M[0][pos]=M[0][pos+1]=M[1][pos+1]=M[1][pos+2]=true;
            answer=max(answer,Solve(pos, I,O,T,J,L,S,Z-1));
            M[0][pos]=M[0][pos+1]=M[1][pos+1]=M[1][pos+2]=false;
        }
    }
    
    
    return answer;
    
    
    
    
}


int main() {

    for(int i=0;i<1000;i++)
        M[0][i]=M[1][i]=false;
    
    
    /*
    
    for(int i=0;i<=5;i++)
        for(int o=0;o<=0;o++)
            for(int t=0;t<=0;t++)
                for(int j=0;j<=5;j++)
                    for(int l=0;l<=5;l++)
                        for(int s=0;s<=0;s++)
                            for(int z=0;z<=0;z++) {
                                int ans = Solve(0,i,o,t,j,l,s,z);
                                if (ans>0) {
                                    int ans2=(i/2+j/2+l/2)*4+((i&1)&&(j&1)&&(l&1))*6;
                                    if (i>=1 && j>=1 && l>=1) {
                                        ans2=max(ans2,6+((i-1)/2+(j-1)/2+(l-1)/2)*4);
                                    }
                                    
                                    printf("%d,%d,%d :: %d %d\n",i,j,l,ans,ans2);
                                    if (ans2!=ans)
                                        exit(-1);
                                }
                            }
     */
    
    
    

    ll I,O,T,J,L,S,Z;
    
    cin>>I>>O>>T>>J>>L>>S>>Z;

    ll ans2=(I/2+J/2+L/2)*4+((I&1)&&(J&1)&&(L&1))*6;
    if (I>=1 && J>=1 && L>=1) {
        ans2=max(ans2,6+((I-1)/2+(J-1)/2+(L-1)/2)*4);
    }
    
    ans2 += O*2;
    
    
    cout << ans2/2 << endl;
    
    
    
    
}

Measured memory_bytes: 384