#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5;
long long a[N], b[N], cur, ans = 0;
signed main() {
  for (long long i = 0; i < 14; ++i) {
    cin >> a[i];
  }
  for (long long f = 0; f < 14; f++) {
    cur = 0;
    for (long long i = 0; i < 14; i++) {
      b[i] = a[i];
    }
    long long c = a[f], l = a[f] / 14;
    b[f] = 0;
    for (long long i = 0; i < 14; i++) {
      b[i] += l;
    }
    c -= l * 14;
    for (long long i = 1; i <= c; i++) {
      b[(f + i) % 14]++;
    }
    for (long long i = 0; i < 14; i++) {
      if (b[i] % 2 == 0) cur += b[i];
    }
    ans = max(ans, cur);
  }
  cout << ans;
}
