#include <bits/stdc++.h>
using namespace std;
const int n = 14;
int main() {
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    long long tmp[n];
    for (int j = 0; j < n; j++) {
      tmp[j] = a[j];
    }
    long long cur = tmp[i];
    tmp[i] = 0;
    long long divs = cur / n;
    for (int j = 0; j < n; j++) {
      tmp[j] += divs;
    }
    int next = i + 1;
    int rem = cur % 14;
    while (rem) {
      if (next == n) {
        next = 0;
      }
      tmp[next]++;
      next++;
      rem--;
    }
    long long tmp_cnt = 0;
    for (int j = 0; j < n; j++) {
      if (1 & tmp[j]) {
        continue;
      }
      tmp_cnt += tmp[j];
    }
    res = max(res, tmp_cnt);
  }
  cout << res;
}
