#include <bits/stdc++.h>
using namespace std;
long long a[1000005], b[1000005];
int dis(int x, int y) {
  if (x < y)
    return y - x;
  else
    return 14 - x + y;
}
int main() {
  for (int i = 1; i <= 14; i++) scanf("%lld", &a[i]);
  long long ans = 0;
  for (int i = 1; i <= 14; i++) {
    if (!a[i]) continue;
    for (int j = 1; j <= 14; j++) b[j] = a[j];
    b[i] = 0;
    for (int j = 1; j <= 14; j++) {
      b[j] += a[i] / 14;
      if (a[i] % 14 >= dis(i, j)) b[j]++;
    }
    long long sum = 0;
    for (int j = 1; j <= 14; j++)
      if (b[j] % 2 == 0) sum += b[j];
    ans = max(ans, sum);
  }
  printf("%lld\n", ans);
  return 0;
}
