#include <bits/stdc++.h>
using namespace std;
long long arr[15];
long long cnt(long long x) {
  long long b[15], ans = 0;
  for (long long i = 0; i < 14; i++) b[i] = arr[i];
  long long n = x + 1;
  b[x] = 0;
  long long lef = arr[x] % 14;
  long long num = arr[x] / 14;
  for (long long i = 0; i < lef; i++) {
    if (n == 14) n = 0;
    b[n]++;
    n++;
  }
  for (long long i = 0; i < 14; i++) b[i] += num;
  for (long long i = 0; i < 14; i++)
    if (!(b[i] & 1)) ans += b[i];
  return ans;
}
int main() {
  long long ans = 0;
  for (long long i = 0; i < 14; i++) cin >> arr[i];
  for (long long i = 0; i < 14; i++) {
    if (arr[i] > 0) {
      ans = max(ans, cnt(i));
    }
  }
  cout << ans;
  return 0;
}
