# include <bits/stdc++.h>

using namespace std;

int aI,aO,aT,aJ,aL,aS,aZ;
int main() {
	scanf("%d%d%d%d%d%d%d",&aI,&aO,&aT,&aJ,&aL,&aS,&aZ);

	long long ans = 0ll + aJ / 2 * 2 + aL / 2 * 2 + aI / 2 * 2 + aO;
	if(aJ && aL && aI) {
		ans = max(ans, 0ll + (aJ - 1) / 2 * 2 + (aL - 1) / 2 * 2 + (aI - 1) / 2 * 2 + aO + 3);
	}

	cout << ans << endl;
}
