#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200100, M = 1000000009;
string s;
long long n, ans = 0, a[MAXN], b[MAXN];
void obra(long long v) {
  long long tc = 0, k = a[v];
  for (long long i = 0; i < n; i++) {
    b[i] = a[i] + k / n;
    if (i == v) b[i] -= a[i];
  }
  k %= 14;
  for (long long i = 0; i < k; i++) {
    b[(v + 1 + i) % n]++;
  }
  for (long long i = 0; i < n; i++) {
    if (b[i] % 2 == 0) {
      tc += b[i];
    }
  }
  if (ans < tc) ans = tc;
}
int main() {
  ios_base::sync_with_stdio(0);
  n = 14;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) obra(i);
  cout << ans;
  return 0;
}
