#include <bits/stdc++.h>
using namespace std;
long long stones[20], act[20];
int main() {
  long long i, ans, rez, each, j;
  for (i = 1; i <= 14; i++) {
    cin >> stones[i];
  }
  ans = 0;
  for (i = 1; i <= 14; i++) {
    if (stones[i] != 0) {
      each = stones[i] / 14;
      memset(act, 0, sizeof(act));
      for (j = 1; j <= 14; j++) act[j] = stones[j] + each;
      act[i] -= stones[i];
      each = stones[i] % 14;
      j = i + 1;
      if (j == 15) j = 1;
      while (each > 0) {
        act[j]++;
        j = (j + 1) % 15;
        if (j == 0) j = 1;
        each--;
      }
      rez = 0;
      for (j = 1; j <= 14; j++)
        if (act[j] % 2 == 0) rez += act[j];
      ans = max(ans, rez);
    }
  }
  cout << ans << '\n';
  return 0;
}
