#include <bits/stdc++.h>
using namespace std;
int main() {
  int I, O, T, J, L, S, Z;
  scanf("%d %d %d %d %d %d %d", &I, &O, &T, &J, &L, &S, &Z);
  int delta = min(min(I, J), L);
  long long cur = 0;
  for (int i = delta; i >= 0 && i >= delta - 1; i--) {
    cur =
        max(cur, (I - i) / 2 * 2 + (J - i) / 2 * 2 + (L - i) / 2 * 2 + i * 3LL);
  }
  cout << cur + O << endl;
  return 0;
}
