#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int a[14], b[14], i, j, max = 0;
  for (i = 0; i < 14; i++) {
    cin >> a[i];
  }
  for (i = 0; i < 14; i++) {
    int temp = a[i];
    for (j = 0; j < 14; j++) {
      b[j] = a[j];
    }
    int d = b[i] / 14;
    temp = b[i] % 14;
    b[i] = 0;
    long long int sum = 0;
    for (j = 0; j < 14; j++) {
      b[j] = b[j] + d;
    }
    for (j = i + 1; j <= (i + temp); j++) {
      b[j % 14]++;
    }
    for (j = 0; j < 14; j++) {
      if (b[j] % 2 == 0) {
        sum = sum + b[j];
      }
    }
    if (max < sum) {
      max = sum;
    }
  }
  cout << max << endl;
}
