#include <bits/stdc++.h>
using namespace std;
long long a[14], arr[14];
long long solve(int idx) {
  long long ret = 0, val = a[idx];
  for (int i = 0; i < 14; i++) arr[i] = a[i];
  arr[idx] = 0;
  for (int i = idx + 1;; i++) {
    i %= 14;
    arr[i] += val / 14;
    if (i == idx) break;
  }
  val %= 14;
  for (int i = idx + 1; val; i++, val--) {
    i %= 14;
    arr[i]++;
  }
  for (int i = 0; i < 14; i++) {
    if (arr[i] % 2 == 0) ret += arr[i];
  }
  return ret;
}
int main() {
  long long ans = 0;
  for (int i = 0; i < 14; i++) cin >> a[i];
  for (int i = 0; i < 14; i++) {
    ans = max(ans, solve(i));
  }
  cout << ans << endl;
}
