#include <bits/stdc++.h>
using namespace std;
const long long maxx = 1e1 + 19;
const long long inf = 1e5 + 19;
const long long mod = 1000000007LL;
long long n = 14, a[maxx] = {};
long long ans = -inf;
long long per(long long x) {
  long long b[maxx] = {};
  for (long long i = 0; i < n; i++) b[i] = a[i];
  long long c = a[x];
  long long j = x + 1;
  b[x] = 0;
  for (long long i = 0; i < n; i++) b[i] += c / 14;
  c %= 14;
  while (c) {
    if (j == n) j = 0;
    c--;
    b[j]++;
    j++;
  }
  long long res = 0;
  for (long long i = 0; i < n; i++)
    if (b[i] % 2 == 0) res += b[i];
  return res;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long k = 0; k < n; k++) ans = max(ans, per(k));
  cout << ans;
  return 0;
}
