#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a[14], b[14];
  for (long long i = 0; i < 14; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  long long mx = 0;
  for (long long i = 0; i < 14; i++) {
    if (a[i] != 0) {
      long long p = a[i];
      long long q = a[i] % 14;
      a[i] = 0;
      for (long long j = 0; j < 14; j++) {
        a[j] += p / 14;
      }
      long long k = i + 1;
      while (q--) {
        a[k % 14]++;
        k++;
      }
      long long s = 0;
      for (long long i = 0; i < 14; i++) {
        if (a[i] % 2 == 0) {
          s += a[i];
        }
      }
      mx = max(s, mx);
      for (long long i = 0; i < 14; i++) {
        a[i] = b[i];
      }
    }
  }
  cout << mx;
}
