#include <bits/stdc++.h>
using namespace std;
int main() {
  long long aa[15];
  long long bb[15];
  for (int i = 0; i < 14; i++) {
    scanf("%lld", &aa[i]);
    bb[i] = aa[i];
  }
  long long maxx = 0;
  for (int i = 0; i < 14; i++) {
    if (!aa[i]) continue;
    long long sum = 0;
    int c = aa[i] % 14;
    for (int k = 1; k <= c; k++) {
      if (i + k < 14)
        bb[k + i]++;
      else {
        bb[(i + k) % 14]++;
      }
    }
    for (int j = 0; j < 14; j++) {
      if (j != i)
        bb[j] += aa[i] / 14;
      else
        bb[j] = aa[i] / 14;
      if (bb[j] % 2 == 0) sum += bb[j];
    }
    if (sum > maxx) maxx = sum;
    for (int j = 0; j < 14; j++) bb[j] = aa[j];
  }
  cout << maxx << endl;
  return 0;
}
