#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a[14];
  long long int temp[14];
  long long int max = 0;
  for (long long int i = 0; i < 14; i++) cin >> a[i];
  for (long long int i = 0; i < 14; i++) {
    long long int sum = 0;
    for (long long int j = 0; j < 14; j++) temp[j] = a[j];
    long long int k = temp[i];
    temp[i] -= k;
    long long int pos = i + 1;
    for (long long int j = 0; j < 14; j++) {
      if (pos == 14) pos = 0;
      temp[pos] += k / 14;
      pos++;
    }
    for (long long int j = 0; j < k % 14; j++) {
      if (pos == 14) pos = 0;
      temp[pos]++;
      pos++;
    }
    for (long long int j = 0; j < 14; j++)
      if (temp[j] % 2 == 0) sum += temp[j];
    if (sum > max) max = sum;
  }
  cout << max << "\n";
}
