#include <bits/stdc++.h>
using namespace std;
const int maxn = 15;
long long a[maxn], b[maxn];
void init() {
  for (int i = 1; i <= 14; i++) b[i] = a[i];
}
long long sum() {
  long long ans = 0;
  for (int i = 1; i <= 14; i++)
    if (b[i] % 2 == 0) ans += b[i];
  return ans;
}
int main() {
  for (int i = 1; i <= 14; i++) cin >> a[i];
  init();
  long long ma = 0;
  for (int i = 1; i <= 14; i++) {
    long long k = a[i];
    b[i] = 0;
    long long c = k / 14;
    int d = k % 14;
    for (int j = 1; j <= 14; j++) b[j] += c;
    for (int j = i + 1; j <= 14 && d > 0; j++, d--) b[j]++;
    for (int j = 1; j <= d; j++) b[j]++;
    ma = max(ma, sum());
    init();
  }
  cout << ma;
  return 0;
}
