#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
LL a[7];
int main() {
	for (int i = 0; i < 7; i++) cin >> a[i];
	LL ans = (a[0] / 2) * 4 + (a[3] / 2) * 4 + (a[4] / 2) * 4;
	if (a[0] > 0 && a[3] > 0 && a[4] > 0) {
		a[0]--; a[3]--; a[4]--;
		ans = max(ans, 6 + (a[0] / 2) * 4 + (a[3] / 2) * 4 + (a[4] / 2) * 4);
	}
	ans += a[1] * 2;
	cout << ans / 2 << endl;
}