#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[14];
  for (int i = 0; i < 14; i++) cin >> a[i];
  long long int score = 0;
  long long int b[14];
  long long int i = 0;
  long long int temp = 0;
  while (i < 14) {
    for (int j = 0; j < 14; j++) b[j] = a[j];
    long long int r = b[i] % 14;
    long long int d = (b[i] - r) / 14;
    b[i] = 0;
    long long int c = 0;
    for (long long int j = i + 1; c < 14; j++) {
      j = j % 14;
      if (c < r) b[j]++;
      c++;
      b[j] += d;
    }
    for (long long int j = 0; j < 14; j++) temp = 0;
    for (int j = 0; j < 14; j++) {
      if (b[j] % 2 == 0) temp += b[j];
    }
    if (temp > score) score = temp;
    i++;
  }
  cout << score << endl;
  return 0;
}
