#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
const double eps = 1e-6;
const double pi = 3.141592653589793238462643385;
const int mod = 1e9;
template <class T>
void show(T a[], int len) {
  for (int i = 1; i <= len; i++) cout << a[i] << " ";
  cout << endl;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long a[20];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i <= 14; i++) {
    cin >> a[i];
  }
  long long b[20];
  long long maxx = 0;
  for (int i = 1; i <= 14; i++) {
    for (int j = 1; j <= 14; j++) b[j] = a[j];
    int k = i;
    int t = b[i];
    if (b[i] + i <= 14) {
      for (int j = i + 1; j <= i + b[i]; j++) b[j]++;
      b[i] = 0;
    } else {
      b[i] = 0;
      t -= 14 - i;
      for (int j = i + 1; j <= 14; j++) b[j]++;
      long long chushu = t / 14, yushu = t % 14;
      for (int j = 1; j <= 14; j++) b[j] += chushu;
      for (int j = 1; j <= yushu; j++) b[j] += 1;
    }
    long long sum = 0;
    for (int j = 1; j <= 14; j++)
      if (b[j] % 2 == 0) sum += b[j];
    maxx = max(maxx, sum);
  }
  cout << maxx << endl;
  return 0;
}
