#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
void solve() {
  vector<long long> v(14);
  long long curr_score = 0;
  long long o = 0;
  for (int i = 0; i < 14; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < 14; i++) {
    vector<long long> t(14);
    for (int k = 0; k < 14; k++) {
      t[k] = v[k];
    }
    long long p = v[i] / 14, q = v[i] % 14;
    t[i] = 0;
    for (int j = 0; j < 14; j++) {
      t[j] += p;
    }
    long long j = i + 1;
    while (q--) {
      if (j == 14) {
        j = 0;
      }
      t[j++]++;
    }
    long long cnt = 0;
    for (int i = 0; i < 14; i++) {
      if (t[i] % 2 == 0) {
        cnt += t[i];
      }
    }
    curr_score = max(curr_score, cnt);
  }
  cout << curr_score << "\n";
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
