#include <bits/stdc++.h>
using namespace std;
int main() {
  long long max_score = 0;
  ;
  long long c[14];
  for (int i = 0; i < 14; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < 14; i++) {
    if (c[i] != 0) {
      long long score = 0;
      long long c1[14];
      copy(c, c + 14, c1);
      long long count = c1[i];
      c1[i] = 0;
      long long minus = count / 14;
      int minc = count % 14;
      for (int j = (i + 1) % 14; count > 0; j++, j %= 14) {
        c1[j] += minus;
        count -= minus;
        if (minc) {
          c1[j]++;
          minc--;
          count--;
        }
      }
      for (int j = 0; j < 14; j++) {
        if (c1[j] % 2 == 0) {
          score += c1[j];
        }
      }
      if (score > max_score) {
        max_score = score;
      }
    }
  }
  cout << max_score << endl;
  return 0;
}
