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.
import java.io.*;
import java.util.*;
import java.util.Map.Entry;

import javafx.util.Pair;


public class Solution {
	public final static int MOD = 30031;
	public static int count = 0;
	public static int dx[] = {-1,1,0,0};
	public static int dy[] = {0,0,-1,1};
	public static int max = 0;
	public static LinkedList<Integer> adj[];
	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws IOException {
		InputReader scan = new InputReader(System.in);
	   	OutputStream outputStream = System.out;
	   	PrintWriter pw = new PrintWriter(outputStream);
	   	StringBuilder sb = new StringBuilder();
	   	int arr[] = new int[14];
	   	for(int i=0;i<14;i++)
	   		arr[i] = scan.nextInt();
	   	long max = 0;
	   	for(int i=0;i<14;i++)
	   	{
	   		long cur_max = 0;
	   		int a = arr[i]/14;
	   		int b = arr[i]%14;
	   		//System.out.println(a+" "+b);
	   		for(int j=1;j<14;j++)
	   		{
	   			long temp = (long)arr[(i+j)%14];
	   			if(j<=b && (temp+a+1)%2==0)
	   				cur_max += temp+a+1;
	   			else if(j>b && (temp+a)%2==0)
	   				cur_max += temp+a;
	   		}
	   		if(a%2==0)
	   			cur_max+=a;
	   		max = Math.max(max, cur_max);
	   	}
	   	pw.println(max);
	  	pw.close();
	}
	public static int binarySearch(int arr[],int key,int size)
	{
		int l = 0, r = size-1;
		while(l<=r)
		{
			int min = (l+r)/2;
			if(arr[min]>key)
				r = min-1;
			else
				l = min+1;
		}
		if(l<size)
			return arr[l];
		else
			return Integer.MIN_VALUE;
	}
	public static void inOrder(int i,int arr[],int n,ArrayList<Integer> ans)
	{
		if(i<n)
		{
			inOrder(2*i+1,arr,n,ans);
			ans.add(arr[i]);
			inOrder(2*i+2,arr,n,ans);
		}
	}
	public static int find(int x,int parent[])
	{
		if(parent[x]!=x)
			parent[x] = find(parent[x],parent);
		return parent[x];
	}
	public static void union(int parent[],int x,int y)
	{
		int xParent = find(x,parent);
		int yParent = find(y,parent);
		parent[xParent] = yParent;
	}
	public static int dfs(int node,int parent,int arr[],int k)
	{
		int max = 0,sec_max = 0;
		for(int i=0;i<adj[node].size();i++)
		{
			if(adj[node].get(i)!=parent){
				int t = dfs(adj[node].get(i),node,arr,k);
				if(max<t)
				{
					sec_max = max;
					max = t;
				}
				else if(sec_max<t)
					sec_max = t;
			}
		}
		if(arr[node]%k==0){
			count = Math.max(count, sec_max+max+1);
			return sec_max+max+1;
		}
		else
			return 0;
	}
	public static void buildTree(int arr[],int tree[],int node,int start,int end)
	{
		if(start==end)
		{
			tree[node] = arr[start];
			return;
		}
		int mid = (start+end)/2;
		buildTree(arr,tree,2*node,start,mid);
		buildTree(arr,tree,2*node+1,mid+1,end);
		tree[node] = tree[2*node]+tree[2*node+1];
	}
	public static void update(int arr[],int tree[],int node,int inx,int val,int start,int end)
	{ 
		if(start==end)
		{
			tree[node] = val;
			arr[inx] = val;
			return;
		}
		int mid = (start+end)/2;
		if(inx<=mid)
			update(arr,tree,2*node,inx,val,start,mid);
		else
			update(arr,tree,2*node+1,inx,val,mid+1,end);
		tree[node] = tree[2*node]+tree[2*node+1];
	}
	public static int query(int tree[],int node,int l,int r,int start,int end)
	{
		if(r<start || l>end)
			return 0;
		if(l<=start && end<=r)
			return tree[node];
		int mid = (start+end)/2;
		int ans1 = query(tree,2*node,l,r,start,mid);
		int ans2 = query(tree,2*node+1,l,r,mid+1,end);
		return ans1+ans2;
	}
	public static void merge(int arr[],int start,int mid,int end)
	{
		int l = start, r = mid+1;
		int temp[] = new int[end-start+1];
		int k = 0;
		for(int i=start;i<=end;i++)
		{
			if(l>mid)
				temp[k++] = arr[r++];
			else if(r>end)
				temp[k++] = arr[l++];
			else if(arr[l]<=arr[r])
				temp[k++] = arr[l++];
			else{
				temp[k++] = arr[r++];
				count+=(mid-l+1);
			}
		}
		for(int i=0;i<k;i++)
			arr[start++] = temp[i];
	}
	public static void mergeSort(int arr[],int l,int r)
	{
		if(l<r){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,mid,r);
		}
	}
	public static void sieve(int spf[],int n)
	{
		for(int i=1;i<=n;i++)
			spf[i] = i;
		for(int i=2;i*i<=n;i++)
		{
			if(spf[i]==i)
			{
				for(int j=i;j<=n;j+=i)
					if(spf[j]==j)
						spf[j] = i;
			}
		}
	}
	public static void factors(int n,int spf[],ArrayList<Integer> factors)
	{
		int pre = 0;
		while(n!=1)
		{
			int temp = spf[n];
			if(temp!=pre)
			{
				factors.add(temp);
				pre = temp;
			}
			n/=temp;
		}
	}
	public static boolean isPrime(int n)
	{
		if(n==0 || n==1)
			return false;
		int limit = (int)Math.sqrt(n);
		for(int i=2;i<=limit;i++)
		{
			if(n%i==0)
				return false;
		}
		return true;
	}
	public static long pow(long a,long b,int m)
	{
		long result = 1;
		while(b>0)
		{
			if(b%2==1)
				result = ((result%m)*(a%m))%m;
			a = ((a%m)*(a%m))%m;
			b/=2;
		}
		return result;
	}
	public static long mulinv(long a,long m)
	{
		long arr[] = new long[2];
		long gcd = gcdExtended(a,m,arr);
		if(gcd==1)
			return (arr[0]%m+m)%m;
		else
			return Integer.MAX_VALUE;
	}
	public static long gcdExtended(long a,long b,long arr[])
	{
		if (a == 0)
	    {
	        arr[0] = 0;
	        arr[1] = 1;
	        return b;
	    }
	    long gcd = gcdExtended(b%a, a, arr);
	    long temp = arr[0];
	    arr[0] = arr[1] - (b/a) * arr[0];
	    arr[1] = temp;
	    return gcd;
	}
	public static long kadane(int items[])
	{
		int n = items.length;
		long max = (long)items[0];
		long curr_max = (long)items[0];
		for(int i=1;i<n;i++)
		{
			curr_max = Math.max((long)curr_max+items[i], items[i]);
			max = Math.max(max, curr_max);
		}
		return max;
	}
	public static long gcd(long a,long b)
	{
		if(b==0)
			return a;
		return gcd(b,a%b);
	}
	public static int LCS(String s1,String s2) //Longest common subsequence
	{
		int n = s1.length();
		int m = s2.length();
		int lcs[][] = new int[n+1][m+1];
		for(int i=0;i<=n;i++)
		{
			for(int j=0;j<=m;j++)
			{
				if(i==0 || j==0)
					lcs[i][j] = 0;
				else if(s1.charAt(i-1)==s2.charAt(j-1))
					lcs[i][j] = lcs[i-1][j-1] + 1;
				else
					lcs[i][j] = Math.max(lcs[i][j-1], lcs[i-1][j]);
			}
		}
		return lcs[n][m];
	}
	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;
        }
    }
}
class InputReader {
    public BufferedReader reader;
	public StringTokenizer tokenizer;
    public InputReader(InputStream inputstream) {
        reader = new BufferedReader(new InputStreamReader(inputstream));
		tokenizer = null;
	}
    public String nextLine(){
        String fullLine=null;
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		    try {
		        fullLine=reader.readLine();
		    } catch (IOException e) {
    			throw new RuntimeException(e);
    			}
        		return fullLine;
        }
		return fullLine;
	}
    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
    			tokenizer = new StringTokenizer(reader.readLine());
    		} catch (IOException e) {
        		throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public long nextLong() {
        return Long.parseLong(next());
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
}