#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(14);
  int64_t Sum = 0;
  for (int i = 0; i <= 13; i++) cin >> a[i];
  for (int i = 0; i <= 13; i++) {
    auto coppy = a;
    int64_t rocks = a[i];
    coppy[i] = 0;
    for (int j = 0; j <= 13; j++) {
      coppy[j] = coppy[j] + rocks / 14;
    }
    rocks = rocks % 14;
    int j = i + 1;
    while (rocks) {
      if (j == 14) j = 0;
      coppy[j]++;
      j++;
      rocks--;
    }
    int64_t Local_Sum = 0;
    for (j = 0; j <= 13; j++) {
      if (coppy[j] % 2 == 0) {
        Local_Sum += coppy[j];
      }
    }
    Sum = max(Sum, Local_Sum);
  }
  cout << Sum;
  return 0;
}
