#include <bits/stdc++.h>
using namespace std;
long long a[20], b[20];
long long ans = 0;
void print() {
  for (int i = 0; i < 14; i++) cout << b[i] << " ";
  cout << endl;
}
int main() {
  for (int i = 0; i < 14; i++) cin >> a[i];
  for (int i = 0; i < 14; i++) {
    if (a[i]) {
      for (int j = 0; j < 14; j++) b[j] = a[j];
      long long score = 0;
      long long tmp = b[i];
      b[i] = 0;
      for (int j = 0; j < 14; j++) b[j] += tmp / 14;
      for (int j = 1; j <= tmp % 14; j++) b[(i + j) % 14]++;
      for (int j = 0; j < 14; j++)
        if (b[j] % 2 == 0) score += b[j];
      ans = max(ans, score);
    }
  }
  cout << ans << endl;
  return 0;
}
