#include <bits/stdc++.h>
using namespace std;
long long findScore(int i, vector<int> t) {
  vector<int> v(t);
  long long score = 0;
  int stones = v[i];
  int common = v[i] / 14;
  int left = v[i] % 14;
  v[i] = 0;
  for (int j = 0; j < 14; j++) v[j] += common;
  int j = i + 1;
  while (left--) {
    v[j % 14] += 1;
    j++;
  }
  for (j = 0; j < 14; j++) {
    if (v[j] % 2 == 0) {
      score += v[j];
    }
  }
  return score;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  int n = 14;
  long long ans = LLONG_MIN;
  vector<int> v(14);
  for (int i = 0; i < 14; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    if (v[i]) ans = max(ans, findScore(i, v));
  }
  cout << ans;
  return 0;
}
