#include<iostream>
#include<cstdio>
#include<algorithm>
#define int long long
using namespace std;

signed main() {
	int a, b, c, d, e, f, g;
	cin >> a >> b >> c >> d >> e >> f >> g;
	int ans = b;
	//a d e
	int MAX = 0;
	if (a&&d&&e) {
		a--; d--; e--;
		MAX = 3 + a / 2*2 + d / 2*2 + e / 2*2;
		a++; d++; e++;
	}
	MAX = max(MAX, a / 2*2 + d / 2 *2 + e / 2*2);
	cout << ans + MAX << endl;
}