#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, p, q;
  long long int sum = 0, max = 0;
  n = 14;
  int a[14], b[n], s[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    if (a[i] != 0) {
      for (j = 0; j < n; j++) {
        b[j] = a[j];
      }
      int p = b[i] / 14;
      int q = b[i] % 14;
      b[i] = 0;
      for (j = 0; j < n; j++) {
        b[j] = b[j] + p;
      }
      p = i;
      for (j = 1; j <= q; j++) {
        p = (p + 1) % 14;
        b[p]++;
      }
      sum = 0;
      for (j = 0; j < n; j++) {
        if (b[j] % 2 == 0) {
          sum = sum + b[j];
        }
      }
      if (max < sum) max = sum;
    }
  }
  printf("%lld\n", max);
}
