#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[15], b[15];
  long long s = 0;
  for (int i = 1; i <= 14; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= 14; i++) {
    copy(a, a + 15, b);
    if (b[i]) {
      long long pre = 0;
      int t = b[i];
      int k = i + 1;
      b[i] = 0;
      if (t <= 14) {
        for (int j = 0; j < t; j++) {
          if (k > 14) k = 1;
          b[k++]++;
        }
      } else {
        int r = t / 14;
        int m = t % 14;
        for (int l = 1; l <= 14; l++) {
          b[l] += r;
        }
        for (int j = 0; j < m; j++) {
          if (k > 14) k = 1;
          b[k++]++;
        }
      }
      for (int l = 1; l <= 14; l++)
        if (b[l] % 2 == 0) pre += b[l];
      s = max(s, pre);
    }
  }
  cout << s << '\n';
  return 0;
}
