#include <bits/stdc++.h>
using namespace std;
int boardSzie = 14;
class Solution {
 public:
  long long board[14];
  long long tmpBoard[14];
  void readData();
  void copyToTmp();
  long long checkField(int i);
  void solve();
};
void Solution::readData() {
  for (int i = 0; i < boardSzie; ++i) {
    cin >> board[i];
  }
}
long long Solution::checkField(int i) {
  long long score = 0;
  copyToTmp();
  long long toRedistribute = tmpBoard[i];
  tmpBoard[i] = 0;
  long long toEveryOne = toRedistribute / boardSzie;
  long long fromI = toRedistribute % boardSzie;
  int j = i + 1;
  while (fromI > 0) {
    j = j % boardSzie;
    tmpBoard[j]++;
    fromI--;
    j++;
  }
  for (int i = 0; i < boardSzie; ++i) {
    tmpBoard[i] += toEveryOne;
    if (tmpBoard[i] % 2 == 0) {
      score += tmpBoard[i];
    }
  }
  return score;
}
void Solution::copyToTmp() {
  for (int i = 0; i < boardSzie; ++i) {
    tmpBoard[i] = board[i];
  }
}
void Solution::solve() {
  long long bestScore = 0;
  for (int i = 0; i < boardSzie; ++i) {
    bestScore = max(bestScore, checkField(i));
  }
  cout << bestScore << endl;
}
int main() {
  Solution solution;
  solution.readData();
  solution.solve();
  return 0;
}
