#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n = 14;
  long long ar[n], ans = 0;
  for (int i = 0; i < 14; i++) cin >> ar[i];
  for (int i = 0; i < n; i++) {
    long long val = ar[i];
    long long d = ar[i] / 14;
    long long rem = ar[i] % 14;
    long long v[n];
    for (int j = 0; j < n; j++) v[j] = ar[j] + d;
    v[i] = d;
    int j = i + 1;
    while (rem > 0) {
      if (j == 14) j = 0;
      v[j]++;
      j++;
      rem--;
    }
    long long sum = 0;
    for (j = 0; j < n; j++) {
      if (v[j] % 2 == 0) sum += v[j];
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
}
