#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long llinf = (long long)3e18;
const int N = (int)2e5 + 111;
const long double PI = (long double)acos(-1);
long long ans = 0;
int n = 14, b[14], a[14];
long long calc(int x) {
  long long res = 0;
  for (int i = 0; i < n; i++) a[i] = b[i];
  int t = b[x] / n;
  a[x] = 0;
  for (int i = x + 1, num = 1;; i++, num++) {
    i %= n;
    a[i] += t + (num <= (b[x] % 14) ? 1 : 0);
    if (i == x) break;
  }
  for (int i = 0; i < n; i++)
    if (a[i] % 2 == 0) res += (long long)a[i];
  return res;
}
int main() {
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  for (int i = 0; i < n; i++) ans = max(ans, calc(i));
  printf("%lld", ans);
  return 0;
}
