#include <bits/stdc++.h>
using namespace std;
int w[17];
int y[17];
int main() {
  long long ans = 0;
  for (int i = 1; i <= 14; i++) {
    scanf("%d", &w[i]);
  }
  for (int i = 1; i <= 14; i++) {
    long long cnt = 0;
    for (int l = 1; l <= 14; l++) {
      y[l] = w[l];
    }
    int key = y[i] / 14;
    int num = y[i] % 14;
    int p = i;
    y[i] = 0;
    for (int l = 1; l <= 14; l++) {
      y[l] += key;
    }
    for (int l = 1; l <= num; l++) {
      p++;
      if (p == 15) {
        p = 1;
      }
      y[p]++;
    }
    for (int l = 1; l <= 14; l++) {
      if (y[l] % 2 == 0) {
        cnt += y[l];
      }
    }
    if (cnt > ans) {
      ans = cnt;
    }
  }
  cout << ans;
  return 0;
}
