#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[14], real[14], b, c, ma = 0, f;
  for (long long i = 0; i < 14; i++) {
    cin >> a[i];
    real[i] = a[i];
  }
  for (long long i = 0; i < 14; i++) {
    if (a[i] > 0) {
      b = a[i];
      a[i] = 0;
      c = i;
      f = b / 14;
      b -= f * 14;
      for (long long i = 0; i < 14; i++) {
        a[i] += f;
      }
      while (b--) {
        c++;
        if (c == 14) c = 0;
        a[c]++;
      }
      c = 0;
      for (long long j = 0; j < 14; j++) {
        if (a[j] % 2 == 0) c += a[j];
      }
      ma = max(ma, c);
    }
    for (long long k = 0; k < 14; k++) {
      a[k] = real[k];
    }
  }
  cout << ma << '\n';
}
