#include<stdio.h>
long long a,b,c,d,e,f,g, res, t;
int main(){
    scanf("%lld%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f,&g);
    res = b;
    t = a%2 + d%2 + e%2;
    if(t>=2 && a&&d&&e){
        a--,d--,e--;
        res+=3;
    }
    printf("%lld\n",res+a/2*2+d/2*2+e/2*2);
}