#include <bits/stdc++.h>
using namespace std;
long long g[20], temp[20];
int main() {
  for (int i = 0; i < 14; i++) cin >> temp[i];
  long long maxx = 0;
  for (int i = 0; i < 14; i++) {
    if (temp[i] == 0) continue;
    for (int j = 0; j < 14; j++) g[j] = temp[j];
    long long ans = 0;
    long long a = g[i] / 14, b = g[i] % 14;
    g[i] = 0;
    for (int k = 0; k < 14; k++) g[k] += a;
    for (int k = 1; k <= b; k++) g[(i + k) % 14]++;
    for (int k = 0; k < 14; k++)
      if (g[k] % 2 == 0) ans += g[k];
    if (ans > maxx) maxx = ans;
  }
  cout << maxx << endl;
  return 0;
}
