#include <bits/stdc++.h>
using namespace std;
const int maxn = 20 + 10;
const int maxm = 3000000 + 10;
const int mod = (int)1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
const double eps = 1e-10;
const double PI = acos(-1.0);
int a[maxn], b[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < 14; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < 14; i++) {
    memcpy(b, a, sizeof(a));
    if (!b[i]) continue;
    int num = b[i];
    b[i] = 0;
    int k = num / 14;
    for (int j = 0; j < 14; j++) b[j] += k;
    for (int j = i + 1; j < i + 1 + num % 14; j++) b[j % 14]++;
    long long res = 0;
    for (int j = 0; j < 14; j++) {
      if (!(b[j] & 1)) res += b[j];
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}
