#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ara[20], ara1[20];
  for (long long i = 1; i <= 14; i++) {
    scanf("%I64d", &ara[i]);
  }
  long long maxi = 0;
  long long sum, c;
  for (long long i = 1; i <= 14; i++) {
    if (ara[i] == 0) {
      continue;
    }
    long long d = ara[i] / 14;
    long long e = ara[i] % 14;
    memset(ara1, 0, sizeof(ara1));
    sum = 0, c = 0;
    if (d > 0) {
      for (long long j = i + 1;; j++) {
        if (j > 14) {
          j = j % 14;
          if (j == 0) {
            j = 14;
          }
        }
        if (i == j) {
          ara1[j] = d;
          break;
        }
        ara1[j] = ara[j] + d;
      }
    }
    for (long long j = i + 1;; j++) {
      if (j > 14) {
        j = j % 14;
        if (j == 0) {
          j = 14;
        }
      }
      if (d == 0) {
        ara1[j] = ara[j] + 1;
      } else {
        ara1[j] = ara1[j] + 1;
      }
      c++;
      if (c >= e) {
        break;
      }
    }
    for (int j = 1; j <= 14; j++) {
      if (ara1[j] % 2 == 0) {
        sum = sum + ara1[j];
      }
    }
    if (sum > maxi) {
      maxi = sum;
    }
  }
  printf("%I64d\n", maxi);
}
