#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> tab(14);
  for (int i = 0; i < 14; i++) {
    cin >> tab[i];
  }
  long long ma = 0LL;
  for (int i = 0; i < 14; i++) {
    if (tab[i] != 0) {
      vector<long long> tmp(tab);
      long long p = tab[i];
      tmp[i] = 0LL;
      long long d = p / 14;
      int r = p % 14;
      for (int j = 0; j < (14); j++) {
        tmp[j] += d;
      }
      for (int j = i + 1; j <= i + r; j++) tmp[j % 14] += 1;
      long long score = 0LL;
      for (auto& el : tmp) {
        if (!(el & 1)) score += el;
      }
      ma = max(ma, score);
    }
  }
  cout << ma << endl;
  return 0;
}
