#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[14], v = 0, b[14], y = 14;
  for (long long int i = 0; i < 14; i++) cin >> a[i];
  for (long long int i = 0; i < 14; i++) {
    for (long long int j = 0; j < 14; j++) b[j] = a[j];
    long long int sum = 0;
    long long int p = b[i];
    b[i] = 0;
    for (long long int w = 0; w < 14; w++) {
      b[w] += p / 14;
    }
    for (long long int k = (i + 1) % 14; k < min((i + 1) % 14 + p % 14, y); k++)
      b[k] += 1;
    if ((i + 1) % 14 + p % 14 > 14) {
      for (long long int k = 0; k < ((i + 1) % 14 + p % 14) % 14; k++)
        b[k] += 1;
    }
    for (long long int l = 0; l < 14; l++) {
      if (b[l] % 2 == 0) sum += b[l];
    }
    v = max(v, sum);
  }
  cout << v << endl;
  return 0;
}
