#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[20], b[20];
  for (int i = 0; i < 14; i++) cin >> a[i];
  long long max1 = 0;
  for (int i = 0; i < 14; i++) {
    memset(b, 0, sizeof b);
    if (a[i] > 0) {
      long long quo = a[i] / 14;
      long long rem = a[i] % 14;
      for (int l = 0; l < 14; l++) {
        if (i != l) b[l] = a[l];
      }
      if (quo > 0) {
        for (int j = 0; j < 14; j++) b[j] = b[j] + quo;
      }
      int k = 1;
      while (k <= rem) {
        b[(i + k) % 14] = b[(i + k) % 14] + 1;
        ++k;
      }
      long long count1 = 0;
      for (int l = 0; l < 14; l++) {
        if (b[l] % 2 == 0) count1 = count1 + b[l];
      }
      max1 = max(max1, count1);
    }
  }
  cout << max1 << endl;
}
