#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double eps = 1e-9;
long double pi = 3.14159265358979323846264338327950;
long double e = 2.7182818284590452353602874713527;
long long ans;
int main() {
  vector<long long> v(15);
  for (int i = 0; i < 14; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < 14; i++) {
    if (v[i] > 0) {
      long long crScore = 0, times = v[i] / 14;
      vector<long long> cr(15);
      cr = v;
      cr[i] = 0;
      for (int k = 0; k < 14; k++) {
        cr[k] += times;
      }
      long long rem = v[i] % 14;
      for (int k = i + 1; rem > 0 && k < 14; ++k) {
        cr[k]++;
        rem--;
      }
      int k = 0;
      while (rem > 0) {
        cr[k++]++;
        rem--;
      }
      for (int j = 0; j < 14; j++) {
        if (cr[j] % 2 == 0) crScore += cr[j];
      }
      ans = max(ans, crScore);
    }
  }
  cout << ans << endl;
  return 0;
}
