#include <bits/stdc++.h>
using namespace std;
inline void FREOPEN() {}
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};
const int root = (int)1;
const int N = (int)123;
const int logN = (int)log2(N) + 1;
const int inf = (int)1e9 + 1e6;
const long long INF = (long long)1e18 + 1e16;
inline int nextInt() {
  int e;
  scanf("%d", &e);
  return e;
}
inline long long nextLong() {
  long long e;
  scanf("%I64d", &e);
  return e;
}
int n = 14;
int a[N];
int b[N];
inline void giveBase() {
  for (int i = 1; i <= n; i++) b[i] = a[i];
}
inline long long calc() {
  long long sum = 0;
  for (int i = 1; i <= n; i++) sum += (b[i] % 2 == 0) ? b[i] : 0;
  return sum;
}
inline long long f(int start) {
  long long k = a[start];
  giveBase();
  b[start] = 0;
  for (int it = start + 1; it <= n && k; it++, k--) b[it]++;
  if (!k) return calc();
  int cnt = k / n;
  int left = k % n;
  for (int i = 1; i <= n; i++) b[i] += cnt;
  for (int i = 1; i <= left; i++) b[i]++;
  return calc();
}
int main() {
  FREOPEN();
  ios_base::sync_with_stdio(0), cin.tie(NULL);
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long mx = 0;
  for (int i = 1; i <= n; i++)
    if (a[i]) mx = max(mx, f(i));
  cout << mx;
  return 0;
}
