#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int maxn = 1e5 + 5;
long long a[15], b[15];
int main() {
  for (int i = 0; i < 14; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = 0; i < 14; ++i) {
    if (a[i] == 0) continue;
    for (int j = 0; j < 14; ++j) b[j] = a[j];
    b[i] = 0;
    for (int j = 0; j < 14; ++j) b[j] += a[i] / 14;
    long long tmp = a[i] % 14;
    int now = (i + 1) % 14;
    while (tmp--) {
      ++b[now];
      now = (now + 1) % 14;
    }
    long long ans1 = 0;
    for (int j = 0; j < 14; ++j) {
      if (b[j] & 1) continue;
      ans1 += b[j];
    }
    ans = max(ans, ans1);
  }
  cout << ans << endl;
  return 0;
}
