#include <bits/stdc++.h>
using namespace std;
inline void file() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  if (0) {
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
  }
}
const int PX[8] = {1, 0, -1, 0, 1, 1, -1, -1},
          PY[8] = {0, 1, 0, -1, -1, 1, 1, -1}, N = 2e6 + 10, INF = 1e9,
          MOD = 1e9 + 7;
const long long INFL = 1e18, MODL = 1e9 + 7;
const long double EPS = 1e-6;
template <typename type>
inline void up(type& a, type b) {
  if (a < b) a = b;
}
inline long long rnd(long long l = 1, long long r = INFL) {
  unsigned long long ans = rand();
  ans = (ans << 16LL) ^ rand();
  ans = (ans << 16LL) ^ rand();
  ans = (ans << 16LL) ^ rand();
  ans %= r - l + 1;
  return (long long)ans + l;
}
int n;
long long a[30];
inline long long f(int pos) {
  long long y, x = a[pos];
  a[pos] = 0;
  y = x % 28;
  for (int i = 0; i < y; ++i) a[(pos + 1 + i) % n]++;
  y = (x - y) / n;
  for (int i = 0; i < n; ++i) a[i] += y;
  long long res = 0;
  for (int i = 0; i < n; ++i)
    if (a[i] % 2 == 0) res += a[i];
  y = x % 28;
  for (int i = 0; i < y; ++i) a[(pos + 1 + i) % n]--;
  y = (x - y) / n;
  for (int i = 0; i < n; ++i) a[i] -= y;
  a[pos] = x;
  return res;
}
int main() {
  file();
  n = 14;
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < n; ++i)
    if (a[i]) up(ans, f(i));
  cout << ans;
}
