#include <bits/stdc++.h>
using namespace std;
long long arr[14];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (auto i = 0; i < (long long)(14); i++) cin >> arr[i];
  long long mx = 0;
  for (auto i = 0; i < (long long)(14); i++) {
    vector<long long> temp;
    for (auto j = 0; j < (long long)(14); j++) temp.push_back(arr[j]);
    if (arr[i]) {
      long long curr = temp[i];
      temp[i] = 0;
      long long rem = 14 - i - 1;
      if (curr >= rem) {
        for (auto j = i + 1; j < (long long)(14); j++) temp[j]++, curr--;
        long long div = curr / 14, remain = curr % 14;
        for (auto j = 0; j < (long long)(14); j++) temp[j] += div;
        for (auto j = 0; j < (long long)(14); j++) {
          if (remain) remain--, temp[j]++;
        }
      } else {
        for (auto j = i + 1; j < (long long)(14); j++)
          if (curr) temp[j]++, curr--;
      }
      long long sum = 0;
      for (auto j = 0; j < (long long)(14); j++) {
        if (temp[j] % 2 == 0) sum += temp[j];
      }
      mx = max(mx, sum);
    }
  }
  cout << mx << '\n';
  return 0;
}
