#include <bits/stdc++.h>
using namespace std;
long long bs(const vector<long long> &ps, const long long &x) {
  long long l = -1, r = (int)(ps).size();
  while (r - l > 1) {
    long long m = l + (r - l) / 2;
    if (ps[m] <= x) {
      l = m;
    } else {
      r = m;
    }
  }
  return l;
}
void solve() {
  long long n = (long long)2e5 + 1, q = (long long)2e5 + 1;
  cin >> n >> q;
  vector<long long> wars(n);
  vector<long long> arrs(q);
  vector<long long> ps(n);
  for (int(i) = (0); (i) < (n); ++(i)) cin >> wars[i];
  for (int(i) = (0); (i) < (q); ++(i)) cin >> arrs[i];
  ps[0] = wars[0];
  for (int(i) = (1); (i) < (n); ++(i)) ps[i] = (ps[i - 1] + wars[i]);
  long long sum = accumulate((wars).begin(), (wars).end(), 0LL);
  long long curr_dmg = 0;
  for (int(i) = (0); (i) < (q); ++(i)) {
    curr_dmg += arrs[i];
    if (curr_dmg >= sum) {
      curr_dmg = 0;
      cout << n << "\n";
    } else {
      long long res = bs(ps, curr_dmg);
      cout << n - res - 1 << "\n";
    }
  }
}
void A() {
  int n;
  cin >> n;
  set<string> ans;
  string s;
  for (int(p) = (0); (p) < (n); ++(p)) {
    cin >> s;
    vector<int> a(26, 0);
    for (int(i) = (0); (i) < ((int)(s).size()); ++(i)) {
      a[s[i] - 'a']++;
    }
    string res = "";
    for (int(i) = (0); (i) < (26); ++(i)) {
      if (a[i] > 0) {
        res.push_back(char(i + 'a'));
      }
    }
    ans.insert(res);
  }
  cout << (int)(ans).size();
}
void B() {
  long long ans = -1;
  vector<long long> a(14, 0);
  for (int(i) = (0); (i) < (14); ++(i)) cin >> a[i];
  for (int i = 0; i < 14; i++) {
    long long restore = a[i];
    a[i] = 0;
    long long add = restore / 14LL;
    long long mod = restore % 14LL;
    long long curr = 0;
    int pos = (i + 1) % 14;
    for (int j = 0; j < mod; j++) {
      if ((a[pos] + 1 + add) % 2 == 0) {
        curr += (a[pos] + 1 + add);
      }
      pos = (pos + 1) % 14;
    }
    for (int j = 0; j < (14 - mod); j++) {
      if ((a[pos] + add) % 2 == 0) {
        curr += (a[pos] + add);
      }
      pos = (pos + 1) % 14;
    }
    ans = max(ans, curr);
    a[i] = restore;
  }
  cout << ans;
}
int main() {
  B();
  return 0;
}
