#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[15], n = 14, mx = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    long long t = a[i], sum = 0, l = a[i] % 14, z = a[i];
    a[i] = 0;
    for (int j = i + 1; t > 0; j++) {
      if (j == n) j = 0;
      long long a1 = z / 14;
      long long x = a[j] + a1;
      if (l > 0) x++, l--, t--;
      if (x % 2 == 0) sum += x;
      t -= a1;
    }
    a[i] = z;
    mx = max(mx, sum);
  }
  cout << mx << endl;
}
