#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e5 + 5;
const double eps = 1e-9;
using namespace std;
long long a[MAXN];
long long b[MAXN];
int main() {
  for (int i = 0; i < (14); i++) scanf("%d", &(a[i]));
  long long ans = 0;
  for (int i = 0; i < 14; i++) {
    if (a[i] == 0) continue;
    for (int j = 0; j < 14; j++) b[j] = a[j];
    int tmp = b[i];
    b[i] = 0;
    for (int j = 0; j < 14; j++) b[j] += tmp / 14;
    tmp %= 14;
    int ind = i + 1;
    while (tmp > 0) {
      ind %= 14;
      b[ind++]++;
      tmp--;
    }
    long long sum = 0;
    for (int j = 0; j < 14; j++)
      if (b[j] % 2 == 0) sum += b[j];
    ans = max(ans, sum);
  }
  printf("%I64d\n", (ans));
  return 0;
}
