#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int arr[15];
  for (int i = 1; i <= 14; i++) cin >> arr[i];
  long long int brr[15];
  long long int ans = -1;
  for (int i = 1; i <= 14; i++) {
    if (arr[i] == 0) continue;
    for (int j = 1; j <= 14; j++) brr[j] = arr[j];
    long long int st = brr[i];
    brr[i] = 0;
    for (int j = 1; j <= 14; j++) brr[j] += st / 14;
    st = st % 14;
    int k = i + 1;
    if (k > 14) k = 1;
    while (st > 0) {
      brr[k] += 1;
      k = k + 1;
      if (k > 14) k = 1;
      st--;
    }
    long long int temp = 0;
    for (int j = 1; j <= 14; j++)
      if (brr[j] % 2 == 0) temp += brr[j];
    ans = (ans > temp) ? ans : temp;
  }
  cout << ans << endl;
  return 0;
}
