#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long a[14], b[14];
  for (int i = 0; i < 14; i++) {
    scanf("%I64d", &a[i]);
  }
  long long maxn = 0;
  for (int i = 0; i < 14; i++) {
    long long x = a[i], y = a[i] / 14, z = a[i] % 14, sum = 0;
    for (int j = 0; j < 14; j++) {
      if (i == j)
        b[j] = y;
      else
        b[j] = a[j] + y;
    }
    for (int j = 1; j <= z; j++) {
      b[(i + j) % 14]++;
    }
    for (int j = 0; j < 14; j++) {
      if (b[j] % 2 == 0) sum += b[j];
    }
    maxn = max(maxn, sum);
  }
  printf("%I64d\n", maxn);
  return 0;
}
