#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a[14], tmp[14];
  for (long long i = 0; i < 14; i++) cin >> a[i];
  long long anss = 0;
  for (long long i = 0; i < 14; i++) {
    for (long long j = 0; j < 14; j++) tmp[j] = a[j];
    long long ans = 0;
    if (tmp[i]) {
      long long k = tmp[i];
      long long add = k / 14;
      long long rem = k % 14;
      tmp[i] = 0;
      long long p = i + 1;
      for (long long j = 0; j < 14; j++) {
        tmp[p % 14] += add;
        p++;
      }
      p = i + 1;
      while (rem) {
        tmp[p % 14]++;
        p++;
        rem--;
      }
      for (long long j = 0; j < 14; j++)
        if (tmp[j] % 2 == 0) ans += tmp[j];
    }
    anss = max(anss, ans);
  }
  cout << anss;
}
