#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
template <typename T>
std::string NumberToString(T Number) {
  std::ostringstream ss;
  ss << Number;
  return ss.str();
}
int biton(int N, int pos) { return N = N | (1 << pos); }
int bitoff(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
long long ar[15], dummy[15], mx = -0x3f3f3f3f;
int main() {
  for (int i = 0; i < 14; i++) cin >> ar[i];
  int pos = 0;
  for (int i = 0; i < 14; i++, pos++) {
    copy(begin(ar), end(ar), begin(dummy));
    int hateache = dummy[pos];
    hateache /= 14;
    int baki = dummy[pos] % 14;
    dummy[pos] = 0;
    if (hateache)
      for (int j = i + 0; j < i + 14; j++) {
        dummy[(j % 14)] += hateache;
      };
    if (baki)
      for (int j = i + 1; j <= i + baki; j++) {
        dummy[(j % 14)]++;
      }
    long long int sum = 0;
    for (int j = 0; j < 14; j++)
      if (dummy[j] % 2 == 0) sum += dummy[j];
    mx = max(mx, sum);
  }
  cout << mx << endl;
  return 0;
}
