#include <bits/stdc++.h>
using namespace std;
vector<long long int> prime;
int main() {
  long long int ar[14], i, j, ma = 0;
  for (i = 0; i < 14; i++) cin >> ar[i];
  for (i = 13; i >= 0; i--) {
    j = i + 1;
    long long int k, temp[14] = {0};
    long long int v = ar[i] / 14, rem = ar[i] % 14;
    for (k = 0; k < 14; k++) temp[k] = ar[k] + v;
    temp[i] = v;
    while (rem--) {
      temp[j % 14]++;
      j++;
    }
    long long int cnt = 0;
    for (k = 0; k < 14; k++)
      if (temp[k] % 2 == 0) cnt += temp[k];
    ma = max(ma, cnt);
  }
  cout << ma;
  return 0;
}
