#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[14], maxm = -1, b[14];
  for (int i = 0; i < 14; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  for (int i = 0; i < 14; i++) {
    if (a[i] > 0) {
      b[i] = 0;
      long long cycle, rem;
      cycle = a[i] / 14;
      rem = a[i] % 14;
      for (int j = 0; j < 14; j++) b[j] += cycle;
      for (int j = i + 1;; j++) {
        if (rem == 0) break;
        if (j > 13) j = 0;
        b[j]++;
        rem--;
      }
    }
    long long sum = 0;
    for (int i = 0; i < 14; i++) {
      if (!(b[i] & 1)) sum += b[i];
      b[i] = a[i];
    }
    maxm = max(sum, maxm);
  }
  cout << maxm << '\n';
}
