#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> Start(20), Now(20);
  long long sum, maxsum = -1;
  for (int i = 0; i < 14; i++) cin >> Start[i];
  for (int i = 0; i < 14; i++) {
    sum = 0;
    Now = Start;
    for (int j = 0; j < 14; j++) {
      if (j == i) Now[j] = 0;
      if ((Start[i] % 14) > ((j - i + 27) % 14)) Now[j]++;
      Now[j] += Start[i] / 14;
      if ((Now[j] & 1) == 0) sum += Now[j];
    }
    maxsum = max(sum, maxsum);
  }
  cout << maxsum;
  return 0;
}
