#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  vector<long long> A(14);
  for (int i = 0; i < 14; i++) cin >> A[i];
  long long ans = 0;
  for (int i = 0; i < 14; i++) {
    vector<long long> B = A;
    long long have = B[i];
    B[i] = 0;
    for (int j = 0; j < 14; j++) {
      int curPos = (i + 1 + j) % 14;
      B[curPos] += have / 14;
      if (j < have % 14) B[curPos]++;
    }
    long long res = 0;
    for (int i = 0; i < 14; i++) res += B[i] % 2 ? 0 : B[i];
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}
