#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[14], b[14], sum, max = 0, q;
  int i, j, r;
  for (i = 0; i < 14; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  for (i = 0; i < 14; i++) {
    sum = 0;
    if (a[i] == 0) continue;
    if (a[i] > 0) {
      b[i] = 0;
      q = a[i] / 14;
      r = a[i] % 14;
    }
    for (j = 0; j < 14; j++) b[j] = b[j] + q;
    j = (i + 1) % 14;
    while (r--) {
      b[j] = b[j] + 1;
      j = (j + 1) % 14;
    }
    for (j = 0; j < 14; j++)
      if (b[j] % 2 == 0) sum = sum + b[j];
    if (sum > max) max = sum;
    for (j = 0; j < 14; j++) b[j] = a[j];
  }
  cout << max;
  return 0;
}
