#include <bits/stdc++.h>
using namespace std;
long long a[30];
long long b[30];
int main() {
  for (int i = 0; i < 14; i++) cin >> a[i];
  long long sum = 0;
  long long ans = -1;
  for (int i = 0; i < 14; i++) {
    sum = 0;
    for (int j = 0; j < 14; j++) b[j] = a[j];
    long long t1 = b[i] / 14;
    long long t2 = b[i] % 14;
    b[i] = 0;
    for (int j = i + 1; j <= i + 14; j++) {
      b[j % 14] += t1;
    }
    for (int j = i + 1; j <= i + t2; j++) {
      b[j % 14] += 1;
    }
    for (int j = 0; j < 14; j++) {
      if (b[j] % 2 == 0) sum += b[j];
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
