#include <bits/stdc++.h>
const int N = (int)1e5 + 7;
const int MAXN = (int)1e6 + 7;
const int LN = 20;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-9;
const int MOD = (int)1e9;
const long long LINF = (int64_t)1e18;
const int INF = (int)2e9;
const int DEL = (int)1e6 + 1;
const int PR = 115249;
using namespace std;
template <typename T>
T sqr(T a) {
  return a * a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(20);
  int n = 14;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long ans = -1;
  for (int i = 0; i < n; i++) {
    if (v[i] == 0) continue;
    vector<long long> cur = v;
    int x = v[i];
    cur[i] = 0;
    for (int j = 0; j < n; j++) cur[j] += x / 14;
    for (int j = i + 1; x % 14 != 0; j++, x--) {
      cur[j % n]++;
    }
    long long res = 0;
    for (int j = 0; j < n; j++) res += (cur[j] % 2 == 0 ? cur[j] : 0);
    ans = max(ans, res);
  }
  cout << ans;
}
