#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long inf = numeric_limits<long long>::max() / 2;
const long double eps = 1e-9;
long long N = 14;
vector<long long> as(N, 0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 0; i < N; i++) {
    cin >> as[i];
  }
  long long ans = 0;
  for (long long i = 0; i < N; i++) {
    if (as[i] <= 0) {
      continue;
    }
    vector<long long> bs = as;
    long long val = bs[i];
    bs[i] = 0;
    for (long long d = 1; d <= N; d++) {
      long long j = (i + d) % N;
      bs[j] += val / N;
    }
    for (long long d = 1; d <= val % N; d++) {
      long long j = (i + d) % N;
      ++bs[j];
    }
    long long a = 0;
    for (long long j = 0; j < N; j++) {
      if (bs[j] % 2 == 0) {
        a += bs[j];
      }
    }
    ans = max(ans, a);
  }
  cout << ans << endl;
  return 0;
}
