#include <bits/stdc++.h>
long long int i, n, a[15], sum, ex, b[15];
int main() {
  for (i = 1; i <= 14; i++) {
    scanf("%lld", &a[i]);
  }
  for (i = 1; i <= 14; i++) {
    ex = 0;
    for (int j = 1; j <= 14; j++) {
      b[j] = 0;
    }
    long long int u = a[i];
    long long int g = a[i] / 14;
    long long int w = a[i] % 14;
    a[i] = 0;
    for (int j = 1; j <= 14; j++) {
      b[j] = a[j] + g;
    }
    for (int j = 1; j <= w; j++) {
      int f = i + j;
      if (f > 14) f = f - 14;
      b[f]++;
    }
    for (int j = 1; j <= 14; j++) {
      if (b[j] % 2 == 0) ex += b[j];
    }
    if (sum < ex && u != 0) sum = ex;
    a[i] = u;
  }
  printf("%lld", sum);
}
