void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n=14;
  auto a=readln.split.to!(long[]);
  long ret=0;
  foreach(i; 0..n)if(a[i]>0){
    auto b=a.dup;
    long k=b[i];
    b[i]=0;
    foreach(j; 0..n) b[j]+=k/n;
    for(int j=1; j<=(k%n).to!(int); j++) b[(i+j)%n]+=1;
    long score=0;
    foreach(e; b)if(e%2==0) score+=e;
    ret=max(ret, score);
  }
  writeln(ret);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}