#include <bits/stdc++.h>
using namespace std;
long long a[15], b[15];
int main() {
  for (int i = 0; i < 14; i++) {
    cin >> b[i];
  }
  long long mx = -1;
  for (int i = 0; i < 14; i++) {
    for (int x = 0; x < 14; x++) a[x] = b[x];
    if (a[i]) {
      long long times = a[i] / 14;
      long long extra = a[i] % 14;
      a[i] = 0;
      for (int j = 0; j < 14; j++) a[j] += times;
      for (int k = (i + 1) % 14, p = 0; p < extra; p++) {
        a[k]++;
        k = (k + 1) % 14;
      }
      long long tmp = 0;
      for (int y = 0; y < 14; y++) {
        if (a[y] % 2 == 0) {
          tmp += a[y];
        }
      }
      if (tmp > mx) mx = tmp;
    }
  }
  cout << mx << endl;
}
