#include <bits/stdc++.h>
using namespace std;
int main() {
  long long arr1[14], arr2[14], sum = 0, maxSum = 0, cur, add;
  for (int i = 0; i < 14; i++) {
    cin >> arr1[i];
    arr2[i] = arr1[i];
  }
  for (int i = 0; i < 14; i++) {
    sum = 0;
    add = arr1[i] / 14;
    cur = arr1[i] % 14;
    arr2[i] = 0;
    for (int j = i, k = 0; k < 14; k++) {
      if (++j == 14) j = 0;
      arr2[j] += add + (cur > 0 ? 1 : 0);
      if (arr2[j] % 2 == 0) sum += arr2[j];
      cur--;
    }
    maxSum = max(sum, maxSum);
    for (int j = 0; j < 14; j++) {
      arr2[j] = arr1[j];
    }
  }
  cout << maxSum;
}
