#include <bits/stdc++.h>
using namespace std;
vector<long long> data;
vector<long long> stone;
long long ANS(0);
inline long long mmax(const long long &a, const long long &b) {
  return a > b ? a : b;
}
int main() {
  for (int i = 0; i < 14; ++i) {
    long long t;
    cin >> t;
    stone.push_back(t);
  }
  data = stone;
  for (int i = 0; i < 14; ++i) {
    long long ans(0);
    long long oper = stone[i];
    stone[i] = 0;
    for (int j = 0; j < 14; ++j) stone[(i + j) % 14] += oper / 14;
    for (int j = 1; j <= oper % 14; ++j) ++stone[(i + j) % 14];
    for (int j = 0; j < 14; ++j)
      if (!(stone[j] % 2)) ans += stone[j];
    ANS = mmax(ANS, ans);
    stone = data;
  }
  cout << ANS << endl;
  return 0;
}
