#include <bits/stdc++.h>
using namespace std;
long long a[14], b[14];
inline long long solve(int x) {
  memcpy(b, a, sizeof(a));
  long long tmp = b[x];
  b[x] = 0;
  long long round = tmp / 14;
  long long lef = tmp % 14;
  for (int i = 0; i < 14; i++) b[i] += round;
  int cur = x + 1;
  while (lef) {
    if (cur >= 14) cur = 0;
    b[cur++]++;
    lef--;
  }
  long long ret = 0;
  for (int i = 0; i < 14; i++) ret += (b[i] & 1) ? 0 : b[i];
  return ret;
}
int main() {
  long long ans = 0;
  for (int i = 0; i < 14; i++) scanf("%I64d", &a[i]);
  for (int i = 0; i < 14; i++) {
    ans = max(ans, solve(i));
  }
  printf("%I64d\n", ans);
  return 0;
}
