#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0, now, a[14], b[14];
  for (int i = 0; i < 14; i++) cin >> a[i];
  for (int i = 0; i < 14; i++) {
    if (a[i] != 0) {
      for (int j = 0; j < 14; j++) b[j] = a[j];
      int r = b[i] % 14, q = b[i] / 14;
      b[i] = 0;
      for (int j = 0; j < 14; j++) b[j] += q;
      for (int j = 1; j <= r; j++) b[(i + j) % 14]++;
      now = 0;
      for (int j = 0; j < 14; j++)
        if (b[j] % 2 == 0) now += b[j];
      ans = max(ans, now);
    }
  }
  cout << ans << endl;
}
