#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[15], maxi, idx, div, sum, r, i, ind, p, SUMMAX[15], ans,
      temp[15], j;
  for (i = 1; i <= 14; i++) {
    scanf("%I64d", &a[i]);
    temp[i] = a[i];
  }
  for (i = 1; i <= 14; i++) {
    maxi = a[i];
    ind = i;
    a[ind] = 0;
    p = 14 - ind;
    if (maxi < p) {
      sum = 0;
      for (j = ind + 1; j <= maxi + 1; j++) {
        a[j] = a[j] + 1;
        if (a[j] % 2 == 0) sum = sum + a[j];
      }
    } else if (maxi > p || maxi == p) {
      for (j = ind + 1; j <= 14; j++) a[j] = a[j] + 1;
      idx = maxi - p;
      div = idx / 14;
      if (div == 0) {
        sum = 0;
        for (j = 1; j <= idx; j++) {
          a[j] = a[j] + 1;
        }
      }
      if (div > 0) {
        r = idx % 14;
        for (j = 1; j <= 14; j++) a[j] = a[j] + div;
        for (j = 1; j <= r; j++) a[j] = a[j] + 1;
      }
      sum = 0;
      for (j = 1; j <= 14; j++) {
        if (a[j] % 2 == 0) sum = sum + a[j];
      }
    }
    SUMMAX[i] = sum;
    for (j = 1; j <= 14; j++) a[j] = temp[j];
  }
  ans = SUMMAX[1];
  for (i = 1; i <= 14; i++) {
    if (SUMMAX[i] > ans) ans = SUMMAX[i];
  }
  printf("%I64d\n", ans);
  return 0;
}
