Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes. 

<image>

Initially, each hole has a_i stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes these stones one by one in the next holes in a counter-clockwise direction.

Note that the counter-clockwise order means if the player takes the stones from hole i, he will put one stone in the (i+1)-th hole, then in the (i+2)-th, etc. If he puts a stone in the 14-th hole, the next one will be put in the first hole.

After the move, the player collects all the stones from holes that contain even number of stones. The number of stones collected by player is the score, according to Resli.

Resli is a famous Mancala player. He wants to know the maximum score he can obtain after one move.

Input

The only line contains 14 integers a_1, a_2, …, a_{14} (0 ≤ a_i ≤ 10^9) — the number of stones in each hole.

It is guaranteed that for any i (1≤ i ≤ 14) a_i is either zero or odd, and there is at least one stone in the board.

Output

Output one integer, the maximum possible score after one move.

Examples

Input

0 1 1 0 0 0 0 0 0 7 0 0 0 0


Output

4


Input

5 1 1 1 1 0 0 0 0 0 0 0 0 0


Output

8

Note

In the first test case the board after the move from the hole with 7 stones will look like 1 2 2 0 0 0 0 0 0 0 1 1 1 1. Then the player collects the even numbers and ends up with a score equal to 4.
//package practice1;

import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

//import Contest.pair;

public class Practice {
	
	
	
///////////////
	
	public static long gcd(long n1, long n2)
    {
        if (n2 != 0)
            return gcd(n2, n1 % n2);
        else
            return n1;
    }
	
////////////////	
	
	
	static class pair {
        Integer x,y;
        pair (int x,int y){
            this.x=x;
            this.y=y;
        }
        
        public boolean equals(Object o)
        {
        	if(o instanceof pair)
        	{
        		pair p=(pair)o;
        		return(x==p.x && y==p.y);
        	}
        	return false;
        }
        
        public int hashcode()
        {
        	return(Integer.hashCode(x)*3 + Integer.hashCode(y));
        }
    }
	
///////////////	
	
	static class Cmp implements Comparator<pair>
	{
		public int compare(pair a,pair b)
		{
			if(a.x==b.x)
			{
				return (a.y-b.y);
			}
			return (a.x-b.x);
		}
	}
	
//////////////	
	
	
	
	   static class FastReader
	   {
		   BufferedReader br;
		   StringTokenizer st;
		   public FastReader()
		   {
			   br = new BufferedReader(new InputStreamReader(System.in));
		   }
		   
		   
		   String next() 
	        { 
	            while (st == null || !st.hasMoreElements()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken(); 
	        } 
		   
		   
		   int nextInt()
		   {
			   return Integer.parseInt(next());
		   }
		   long nextLong()
		   {
			   return Long.parseLong(next());
		   }
		   double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
		   
		   String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        } 
	   }
	   
	   
////////////////
	   
	   
	   
///////////////   
	   
	   
	  public static long Divisors(long n) 
	   { 
	       // Note that this loop runs till square root 
		   long sum=0;
	       for (int i=1; i*i<=(n); i++) 
	       { 
	           if (n%i == 0) 
	           { 
	               // If divisors are equal, print only one 
	               if (n/i == i) 
	               {
	                  // printf("%d ", i); 
	            	   sum=sum+1;
	               }
	     
	               else // Otherwise print both 
	               {
	                   //printf("%d %d ", i, n/i); 
	            	   sum=sum+2;
	               }
	           } 
	           if(sum>3)
	           {
	        	   break;
	           }
	       } 
	       return(sum);
	   } 
	   
	  
	  
////////////////////	  
	  
	  public static long SmallestPrimeDivisor(long n) 
	  { 
	      // if divisible by 2 
	      if (n % 2 == 0) 
	          return 2; 
	    
	      // iterate from 3 to sqrt(n) 
	      for (long i = 3; i * i <= n; i += 2) { 
	          if (n % i == 0) 
	              return i; 
	      } 
	    
	      return n; 
	  } 
	    
//////////////////	  
	   
	   public static boolean isprime(long n)
	    {
	        int count=0;
	     
	        for(long i=2;i*i<=n;i++)
	        {
	            if(n%i==0)
	            {
	                return(false);
	            }
	        }
	        return(true);
	    }
	
	   
/////////////////
	 
	//No.of SubArray which have exactly k different elements //   
	   public static int subArray(int a[],int k)
	   {
		   int count=0;
		   int left=0;
		   int right=0;
		   int n=a.length;
		   HashMap<Integer,Integer> h=new HashMap();
		   while(right<n)
		   {
			   h.put(a[right],(int)h.getOrDefault(a[right],0)+1);
			   while(h.size()>k)
			   {
				   h.put(a[left],h.get(a[left])-1);
				   
				   if(h.get(a[left])==0)
				   {
					   h.remove(a[left]);
				   }
				   
				   left++;
			   }
			   count+=right-left+1;
			   right++;
			 
			   

		   }
		   
		   
		   return count;
		   
	   }
	   
	   
/////////////////
	   
	   //find SubArray which has sum =k //
	   public static int[] sumk(int a[],int sum)
	   {
		   int b[]=new int[2];
		   b[0]=-1;
		   b[1]=-1;
		   int n=a.length;
		   HashMap<Integer,Integer> h=new HashMap();
		   int c_sum=0;
		  for(int i=0;i<n;i++)
		  {
			  c_sum+=a[i];
			  if(c_sum==sum)
			  {
				  b[0]=0;
				  b[1]=i;
				  break;
				 // System.out.println(b[0]+" "+b[1]);
			  }
			  
			  if(h.containsKey(c_sum-sum))
			  {
				  b[0]=h.get(c_sum-sum)+1;
				  b[1]=i;
				  break;
				 // System.out.println(b[0]+" "+b[1]);

			  }
			  
			  h.put(c_sum,i);
		  }
		  return(b);
	   }
	   
	   
	   
////////////
	   
	   
//No.of SubArray which have given element exatly k times //   
public static int ExactlyKTimes(char a[],char c,int k)
{
int count=0;
int left=0;
int right=0;
int n=a.length;
HashMap<Character,Integer> h=new HashMap();
while(right<n)
{
h.put(a[right],(int)h.getOrDefault(a[right],0)+1);
while(h.get(c)>k && left<=right)
{
h.put(a[left],h.get(a[left])-1);

if(h.get(a[left])==0)
{
h.remove(a[left]);
}

left++;
}
count+=right-left+1;
right++;



}


return count;

}


/////////////////////
                /////No.of subArray or SubString in which Each elements occour at most K times//////

     public static int AtMostK(char c[],int k)
     {
    	 int left=0,right=0,count=0;
    	 HashMap<Character,Integer> h=new HashMap();
    	 int n=c.length;
    	 while(right<n)
    	 {
    		 h.put(c[right],h.getOrDefault(c[right],0)+1);
    		 while(h.get(c[right])>k)
    		 {
    			 h.put(c[left],h.get(c[left])-1);
    			 if(h.get(c[left])==0)
    			 {
    				 h.remove(c[left]);
    			 }
    			 left++;
    		 }
    		 count+=right-left+1;
    		 right++;
    	 }
    	 return count;
    	 
     }
     


////////////////////
     //Longest Substring which has k unique characters//
     public static int longestK(char c[],int k)
     {
    	 int max=-1;
    	 int left=0,right=0;
    	 int n=c.length;
    	 HashMap<Character,Integer> h=new HashMap();
    	 int m=0;
    	 while(right<n)
    	 {
    		 h.put(c[right],h.getOrDefault(c[right],0)+1);
    		 m++;
    		 while(h.size()>k)
    		 {
    			 h.put(c[left],h.get(c[left])-1);
    			 m--;
    			 if(h.get(c[left])==0)
    			 {
    				 h.remove(c[left]);
    				 
    			 }
    			 left++;
    		 }
    		 if(h.size()==k)
    		 {
    			 if(m>max)
    			 {
    				 max=m;
    			 }
    		 }
    		 right++;
    	 }
    	 
    	 return max;
     }
     
     
     
     
     
////////////////////
     // Longest Prefix which is also Suffix//
     public static int PrefixSuffix(String s)
     {
    	 int i=0,j=1,m=1;
    	 int n=s.length();
    	 char c[]=s.toCharArray();
    	 int a[]=new int[n];
    	 a[0]=0;
    	 while(m<n)
    	 {
    		
    		if(c[i]==c[j])
    		{
    			a[m]=i+1;
    			m++;
    			i++;
    			j++;
    		}
    		else
    		{
    			if(i==0)
    			{
    				a[m]=0;
    				m++;
        			j++;

    			}
    			else
    			{
    			    i=a[i-1];
    			}
    		}
    		
    	 }
    	 return a[n-1];
     }
     
     
     
     
     
////////////////////
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   
	   

		public static void main(String []args) throws Exception
		{
			//Scanner in=new Scanner(System.in);
			 FastReader in =new FastReader();	
			 PrintWriter pw = new PrintWriter(System.out);
			   
			 int a[]=new int[14];
			 long max=0;
			 for(int i=0;i<14;i++)
			 {
				 a[i]=in.nextInt();
			 }
			 
			
			 for(int i=0;i<14;i++)
			 {
				 int y=a[i];
				 int z=y/14;
				 y-=z*14;
				 int m1=i+1;
				 int m2=i+1;
				 long sum=0;
				 if(a[i]!=0)
				 {
				  for(int j=i+1;y>0;j++)
				  {
					 int k=a[j%14]+z+1;
					 if(k%2==0)
					 {
						 sum+=k;
					 }
					 y--;
					 m2=j%14;
				  }
				 
				 
				 if(m2>=m1)
				 {
					 for(int j=0;j<14;j++)
					 {
						 if(j<m1 || j>m2)
						 {
							 int k=a[j]+z;
							 if(j==i)
							 {
								 k=z;
							 }
							 if(k%2==0)
							 {
								 sum+=k;
							 }
						 }
					 }
				 }
				 else
				 {
					 for(int j=m2+1;j<m1;j++)
					 {
						 int k=a[j]+z;
						 if(j==i)
						 {
							 k=z;
						 }
						 if(k%2==0)
						 {
							 sum+=k;
						 }
					 }
				 }
				 }
				 
				// pw.println(i+" "+sum);
				 max=Math.max(sum,max);
			 }
			 pw.println(max);

			
	        pw.flush();
			pw.close();
			
			
			
			
	}
		
		
}		
		
		
		
		
		
		
		
	

