#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n = 14;
  vector<long long int> holes(n);
  for (int i = 0; i < n; i++) cin >> holes[i];
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    vector<long long int> aux = holes;
    long long int cant = holes[i];
    if (cant == 0) continue;
    long long int cuno = cant / 14ll, sobra = cant % 14ll;
    aux[i] = 0;
    for (int j = 0; j < n; j++) {
      aux[j] += cuno;
    }
    int idx = i + 1;
    while (sobra--) {
      if (idx == 14) idx = 0;
      aux[idx]++;
      idx++;
    }
    long long int res = 0;
    for (int j = 0; j < n; j++) {
      if (aux[j] % 2 == 0) res += aux[j];
    }
    ans = max(res, ans);
  }
  cout << ans << '\n';
  return 0;
}
