#include <bits/stdc++.h>
using namespace std;
int n;
int a[20];
int b[20];
int main() {
  for (int i = 1; i <= 14; ++i) scanf("%d", &a[i]);
  long long Sol = 0;
  for (int i = 1; i <= 14; ++i) {
    if (a[i] == 0) continue;
    for (int j = 1; j <= 14; ++j) b[j] = a[j];
    int k = b[i] / 14, rest = b[i] % 14;
    b[i] = 0;
    for (int j = 1; j <= 14; ++j) b[j] += k;
    int j = i + 1;
    while (rest > 0) {
      if (j > 14) j = 1;
      ++b[j++];
      --rest;
    }
    long long Sum = 0;
    for (int j = 1; j <= 14; ++j)
      if (b[j] % 2 == 0) Sum += b[j];
    if (Sum > Sol) Sol = Sum;
  }
  printf("%lld", Sol);
  return 0;
}
