#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a[14], a1[14], a2[14], max = 0;
  for (long long i = 0; i < 14; i++) cin >> a2[i];
  for (long long i = 0; i < 14; i++) {
    long long j = i + 1;
    for (long long e = 0; e < 14; e++) a[e] = a2[e];
    long long q = a[i] / 14;
    long long r = a[i] % 14;
    a[i] = 0;
    for (long long h = 0; h < 14; h++) a[h] += q;
    while (r--) {
      if (j <= 13) {
        a[j]++;
        j++;
      } else {
        a[j - 14]++;
        j++;
      }
    }
    long long k = 0;
    for (long long g = 0; g < 14; g++)
      if (a[g] % 2 == 0) k += a[g];
    if (k > max) max = k;
  }
  cout << max << endl;
  return 0;
}
