#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int sz = 1e7 + 4;
const signed long long int MIN = numeric_limits<signed long long int>::min();
int main() {
  int a[14];
  for (int i = 0; i < 14; i++) {
    cin >> a[i];
  }
  signed long long int ans = INT_MIN;
  for (int i = 0; i < 14; i++) {
    if (a[i] > 0) {
      int b[14];
      for (int j = 0; j < 14; j++) {
        b[j] = a[j];
      }
      int v = a[i] / 14;
      int rem = a[i] % 14;
      b[i] = 0;
      b[i] += v;
      for (int j = (i + 1) % 14; j != i; j = (j + 1) % 14) {
        b[j] += v;
      }
      int j = (i + 1) % 14;
      for (int k = 0; k < rem; k++) {
        b[j]++;
        j = (j + 1) % 14;
      }
      signed long long int val = 0;
      for (int k = 0; k < 14; k++) {
        if (b[k] % 2 == 0) {
          val += b[k];
        }
      }
      ans = max(ans, val);
    }
  }
  cout << ans << "\n";
  return 0;
}
