#include <bits/stdc++.h>
using namespace std;
void solve() {
  unsigned long long int game[14];
  for (int i = 0; i < 14; i++) {
    cin >> game[i];
  }
  unsigned long long int sum = 0;
  unsigned long long int maxSum = 0;
  unsigned long long int k = 0;
  unsigned long long int k1;
  int p = 0;
  int j;
  for (int i = 0; i < 14; i++) {
    if (game[i] == 0) {
      continue;
    }
    k = game[i] / 14;
    k1 = game[i];
    p = game[i] % 14;
    int p2 = 14 - p;
    j = i + 1;
    game[i] = 0;
    while (p--) {
      if (j == 14) {
        j = 0;
      }
      if ((game[j] + 1 + k) % 2 == 0) {
        sum += game[j] + 1 + k;
      }
      j++;
    }
    while (p2--) {
      if (j == 14) {
        j = 0;
      }
      if ((game[j] + k) % 2 == 0) {
        sum += game[j] + k;
      }
      j++;
    }
    if (sum > maxSum) {
      maxSum = sum;
    }
    sum = 0;
    game[i] = k1;
  }
  cout << maxSum << "\n";
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
