#include <bits/stdc++.h>
using namespace std;
vector<long long int> a(14), b(14);
long long int res, aa, aaa, ans;
int main() {
  long long int sz = 14;
  for (long long int i = 0; i < sz; i++) cin >> a[i];
  for (long long int i = 0; i < sz; i++) {
    ans = 0, b = a, b[i] = 0;
    aaa = a[i] % sz, aa = a[i] / sz;
    for (long long int j = 0; j < sz; j++) b[j] += aa;
    for (long long int j = 1; j <= aaa; j++) b[(i + j) % sz]++;
    for (long long int j = 0; j < sz; j++)
      if (b[j] % 2 == 0) ans += b[j];
    res = max(res, ans);
  }
  return cout << res, 0;
}
