Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.   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.

The only line contains 14 integers $$$a_1, a_2, \ldots, a_{14}$$$ ($$$0 \leq a_i \leq 10^9$$$) — the number of stones in each hole. It is guaranteed that for any $$$i$$$ ($$$1\leq i \leq 14$$$) $$$a_i$$$ is either zero or odd, and there is at least one stone in the board.

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

NoteIn 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$$$.

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 *
 * @author SNEHITH
 */
public class problem_B {
    public static void main(String[] args){
        long arr[] = new long[14];
        long arr1[] = new long[14];
        long max=-1;
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<14;i++)   arr[i] = sc.nextLong();
        for(int j=0;j<14;j++)   arr1[j] = arr[j];

        for(int i=0;i<14;i++){
            long cur = arr[i];
            int j;
            long count = 0,res_temp=0,remainder=0;
            arr[i] = 0;
            for(j=0;j<14;j++){
                arr[j] += cur/14;
            }
            remainder = cur%14;
            j=0;
            while(count<remainder){
                arr[(i+j+1)%14] += 1;
                count++;
                j++;
            }
            for(j=0;j<14;j++)
                if(arr[j]%2 == 0)
                    res_temp += arr[j];
            max = Math.max(res_temp, max);
            for(j=0;j<14;j++)
                arr[j] = arr1[j];
        }
        System.out.println(max);
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = 14;
		long max = 0;
		long[] ar = new long[14];
		for(int i=0;i<n;i++){
			ar[i]=in.nextInt();
		}
		for(int i = 0; i<n;i++){
			long temp[] = new long[14];
			for(int j=0;j<n;j++){
				temp[j]=ar[j];
			}
			long m = ar[i];
			if(m>0){
				temp[i]=0;
				long a = m/14;
				long r = m%14;
				for(int j = 0;j<n;j++){
					temp[j]+=a;
				}

				int tempi = i;
				for(int j=0;j<r;j++){

					if(tempi==13){
						temp[0]+=1;
						tempi=0;
					}else{
						temp[tempi+1]+=1;
						tempi++;
					}
				}
				long tempm=0;

				for(int j=0;j<n;j++){
					if(temp[j]%2==0){
						tempm+=temp[j];
					}
				}

				if(max<tempm){

					max = tempm;}
			}

		}

		System.out.println(max);

	}

}

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner myScanner = new Scanner(System.in);
		int[] board = new int[14];

		for(int i = 0; i < 14; i++) {
			board[i] = myScanner.nextInt();
		}

		ArrayList<Long> myList = new ArrayList<Long>();

		for(int i = 0; i < 14; i++) {
			if(board[i] != 0) {
				int[] adder = new int[14];
				for(int j = 0; j < 14; j++) {
					adder[(i+j+1)%14] = board[(i+j+1)%14];
					adder[i] = 0;
					adder[(i+j+1)%14] += (board[i]>j)?(board[i]-j+13)/14:0;
				}
				long count = 0;
				for(int j = 0; j < 14; j++) {
					count += (adder[j]%2==0)?adder[j]:0;
				}
				//System.out.println(count);
				myList.add(count);
			}
		}

		long max = 0;
		for(long temp:myList) {
			if(temp>max) max = temp;
		}

		System.out.println(max);
	}

}

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;

public class B {

	public static void main(String args[]) {
		JS in = new JS();
		PrintWriter out = new PrintWriter(System.out);

		long ar[] = new long[14];
		for(int i = 0; i < 14; i++) {
			ar[i] = in.nextLong();
		}
		long best = 0;
		for(int i = 0; i < 14; i++) {
			if(ar[i] == 0) continue;
			long a[] = Arrays.copyOf(ar, 14);
			long have = a[i];
			a[i] = 0;
			long each = have/14;
			long rem = have%14;
			for(int j = 0; j < 14; j++) a[j] += each;
			long res = 0;

			int cc = i+1;
			if(cc == 14) cc = 0;
			for(int j = 0; j < rem; j++) {
				a[cc]++;
				cc++;
				if(cc==14)cc = 0;
			}
			for(int j = 0; j < 14; j++) {
				if(a[j]%2==0)res+=a[j];
			}

			best = Math.max(best,res);

		}

		System.out.println(best);

		out.close();
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class TryB
{

    static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}

		public String rs() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

    static long mod=1000000007;
    static BigInteger bigInteger = new BigInteger("1000000007");
    static int n = (int)1e6;
    static boolean[] prime;
    static ArrayList<Integer> as;
    static void sieve() {
			Arrays.fill(prime	, true);
			prime[0] = prime[1] = false;
			for(int i = 2 ; i * i <= n ; ++i) {
				if(prime[i]) {
					for(int k = i * i; k< n ; k+=i) {
						prime[k] = false;
					}
				}
			}

		}
		static PrintWriter w = new PrintWriter(System.out);

    public static void main(String[] args)
    {

        InputReader sc = new InputReader(System.in);
        //PrintWriter w = new PrintWriter(System.out);

       /*
        prime  = new boolean[n + 1];
		sieve();
		prime[1] = false;
		*/
		/*
		as = new ArrayList<>();
		for(int i=2;i<=1000000;i++)
		{
		    if(prime[i])
		    as.add(i);
		}
		*/

       /*

	long a = sc.nl();

            BigInteger ans = new BigInteger("1");
            for (long i = 1; i < Math.sqrt(a); i++) {
                if (a % i == 0) {
                    if (a / i == i) {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));

                    } else {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));
                        ans = ans.multiply(BigInteger.valueOf(phi(a / i)));

                    }

                }
            }
            w.println(ans.mod(bigInteger));
            */

       int []a = sc.nia(14);
       int x = 0;
       int y = 0;
       long ans = -1;
       for(int i=0;i<14;i++)
       {
           int []b = new int[14];
           for(int j=0;j<14;j++)
           {
               b[j] = a[j];
           }
           if(a[i] > 0)
           {
               x = a[i]/14;
               y = a[i]%14;
               b[i] = 0;

               for(int j=0;j<14;j++)
           {
               b[j] += x;

           }
               int k = (i+1)%14;
               while(y-- > 0)
               {
                   b[k]++;
                   k = (k+1)%14;
               }
               long sum = 0;
               for(int j=0;j<14;j++)
               {
                   if(b[j] %2 == 0)
                   {
                       sum += (long)b[j];
                   }
               }
               ans = (long) Math.max(ans, sum);

           }

       }
       w.println(ans);

      w.close();

    }
    static int opens(String p)
    {
        int c = 0;
        for(int i=0;i<p.length();i++)
        {
            if(p.charAt(i) == '(')
            {
                c++;
            }
            else
            {
                c--;
                if(c < 0)
                    return -1;
            }
        }
        return c;
    }
    static int closes(String p)
    {
        int c = 0;
        for(int i=p.length()-1;i>=0;i--)
        {
            if(p.charAt(i) == ')')
            {
                c++;
            }
            else
            {
                c--;
                if(c < 0)
                    return -1;
            }
        }
        return c;
    }
     static long modexp(long x,long n,long M)
{
    long power = n;
    long result=1;
    while(power>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        power = power/2;
    }
    return result;
}
     static long modInverse(long A,long M)
{
    return modexp(A,M-2,M);
}

     public static long modMultiply(long one, long two) {

		return (one % mod * two % mod) % mod;
	}
    static long fx(int m)
    {
        long re = 0;
        for(int i=1;i<=m;i++)
        {
            re += (long) (i / gcd(i,m));
        }
        return re;
    }
     static long gcd(long a, long b)
    {
	 if (a == 0)
	  return b;

	return gcd(b%a, a);
    }

     static long phi(long nx)
    {
        // Initialize result as n
        double result = nx;

        // Consider all prime factors of n and for
        // every prime factor p, multiply result
        // with (1 - 1/p)
        for (int p = 0; as.get(p) * as.get(p) <= nx; ++p)
        {
            // Check if p is a prime factor.
            if (nx % as.get(p) == 0)
            {
                // If yes, then update n and result
                while (nx % as.get(p) == 0)
                    nx /= as.get(p);
                result *= (1.0 - (1.0 / (double) as.get(p)));
            }
        }

        // If n has a prime factor greater than sqrt(n)
        // (There can be at-most one such prime factor)
        if (nx > 1)
            result *= (1.0 - (1.0 / (double) nx));

        return (long)result;

        //return(phi((long)result,k-1));

    }

    public static int primeFactors(int n)
    {
        int sum = 0;
        // Print the number of 2s that divide n
        while (n%2==0)
        {
            sum = 1;
            //System.out.print(2 + " ");
            n /= 2;
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (int i = 3; i <= Math.sqrt(n); i+= 2)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {

               // System.out.print(i + " ");
                n /= i;
            }
            sum++;
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (n > 2)
            sum++;
            return sum;
    }
    static int digitsum(int x)

    {

        int sum = 0;
        while(x > 0)
        {
            int temp = x % 10;
            sum += temp;
            x /= 10;
        }
        return sum;

    }
    static int countDivisors(int n)
    {
        int cnt = 0;
        for (int i = 1; i*i <=n; i++)
        {
             if (n % i == 0 && i<=1000000)
             {
                // If divisors are equal,
                // count only one
                if (n / i == i)
                   cnt++;

                else // Otherwise count both
                    cnt = cnt + 2;
             }
         }
        return cnt;
    }

    static boolean isprime(int n)
    {

    if(n == 2)
        return true;
    if(n == 3)
        return true;
    if(n % 2 == 0)
        return false;
    if(n % 3 == 0)
        return false;

    int i = 5;
   int w = 2;

    while(i * i <= n)
    {
        if(n % i == 0)
            return false;

        i += w;
        w = 6 - w;
    }

    return true;
    }

    static long log2(long value) {
    return Long.SIZE-Long.numberOfLeadingZeros(value);
}

    static boolean binarysearch(int []arr,int p,int n)
    {
        //ArrayList<Integer> as = new ArrayList<>();
        //as.addAll(0,at);
        //Collections.sort(as);
        boolean re = false;
        int st = 0;
        int end = n-1;

        while(st <= end)
        {
            int mid = st + (end-st)/2;

            if(p > arr[mid])
            {
                st = mid+1;

            }
            else if(p < arr[mid])
            {
                end = mid-1;

            }
            else if(p == arr[mid])
            {

            re = true;
            break;
            }

        }
         return re;

    }

    static class Student
    {

        int position;
        int value;
        Student(int position,int value)
        {
            this.position = position;
            this.value = value;

        }

    }
    /* Java program for Merge Sort */
static class MergeSort
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

    /* A utility function to print array of size n */

}

    public static int ip(String s){
		return Integer.parseInt(s);
	}
	 public static String ips(int s){
		return Integer.toString(s);
	}

}

import java.io.InputStream;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/

public class TREE31{
    public static void main(String[] args) throws java.lang.Exception{
        InputReader in=new InputReader(System.in);
        StringBuffer str=new StringBuffer();
        long arr[]=new long[14];
        long new_arr[][]=new long[14][14];
        int i=0,j=0;
        for(i=0;i<14;i++)
            arr[i]=in.nextLong();
        for(i=0;i<14;i++){
            for(j=0;j<14;j++)
                new_arr[i][j]=arr[j];
            new_arr[i][i]=0;
        }
        for(i=0;i<14;i++){
            long p=arr[i]/14;
            for(j=0;j<14;j++)
                new_arr[i][j]+=p;
            long q=arr[i]%14;
            if(i+q>=14){
                for(j=i+1;j<14;j++)
                    new_arr[i][j]++;
                q=q-13+i;
                for(j=0;j<q;j++)
                    new_arr[i][j]++;
            }
            else{
                for(j=i+1;j<=i+q;j++)
                    new_arr[i][j]++;
            }
        }
        /*for(i=0;i<14;i++) {
        	for(j=0;j<14;j++)
        		System.out.print(new_arr[i][j]+" ");
        	System.out.println();;
        }*/
        long max=-1;
        for(i=0;i<14;i++){
            long sum=0;
            for(j=0;j<14;j++){
                if(new_arr[i][j]%2==0)
                    sum+=new_arr[i][j];
            }
            max=Math.max(max,sum);
        }
        System.out.println(max);
    }

    static class InputReader{
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}

//package round478;

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main23 {

    public static void main(String[] args) {

        Main23.FastScanner sc = new Main23.FastScanner();
        long res = 0;

        int[] mas = new int[14];

        for (int i = 0;i<14;++i) {
            mas[i] = sc.nextInt();
        }

        for (int i = 0;i<14;++i) {
            int[] ms = Arrays.copyOf(mas, mas.length);
            ms[i] = 0;
            int n = mas[i];
            int r = n % 14;
            n /= 14;
            for (int j=0;j<14;++j) {
                ms[j] += n;
            }
            for (int j=0;j<r;++j) {
                ms[(i+j+1)%14]++;
            }

            long sum = 0;
            for (int j=0;j<14;++j) {
                if (ms[j]%2 == 0) sum+=ms[j];
            }
            if (sum>res) res = sum;
        }

        System.out.println(res);

    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }
    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class D {

    long MODULO = 1L * 1000 * 1000 * 1000 * 1000 * 1000 ;
    long b = 31;
    String fileName = "";
    class Point{
        int x, y;
        Point(int x, int y){
            this.x = x;
            this.y = y;
        }
    }

    //////////////////////    SOLUTION   SOLUTION  SOLUTION    //////////////////////////////
    int INF = Integer.MAX_VALUE;
    class Segment implements Comparable<Segment>{
        int start, end, ind;
        Segment(int start, int end, int ind){
            this.start = start;
            this.end = end;
            this.ind = ind;
        }

        @Override
        public int compareTo(Segment o) {
            if(this.start == o.start){
                return -Integer.compare(this.end, o.end);
            }
            return Integer.compare(this.start, o.start);
        }
    }
    void solve() throws IOException {
        int n = 14;
        int[] a = readIntArray(n);
        long ans = 0;
        for(int i=0; i<n; ++i){
            int[] curArr = new int[n];
            for(int j=0; j<n; ++j){
                curArr[j] = a[j];
            }
            int plusAll = a[i] / 14;
            int mod = a[i] % 14;
            curArr[i] = 0;
            curArr[i] += plusAll;
            long curSum = 0;
            if(curArr[i] %2 == 0){
                curSum += curArr[i];
            }
            for(int j=i+1; j < i + 14; ++j){
                curArr[j % n] += plusAll;
                if(mod > 0){
                    curArr[j % n]++;
                    mod--;
                }
                if(curArr[j % n] % 2 == 0){
                    curSum += curArr[j % n];
                }
            }
            ans = Math.max(ans, curSum);
        }
        out.println(ans);
    }
    class Pair implements Comparable<Pair>{
        long a, b;
        Pair(long a, long b){
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Pair o) {

            return -Long.compare(Math.max(this.a - this.b, 0), Math.max(o.a - o.b, 0));
        }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////
    int binSearchRight(int[] a, int val){
        int l = -1;
        int r = a.length;
        while(r - l > 1){
            int mid = (r+l)/2;
            if(a[mid] >= val){
                r = mid;
            }else{
                l = mid;
            }
        }
        return r == a.length ? INF :a[r];
    }
    int binSearchLeft(int[] a, int val){
        int l = -1;
        int r = a.length;
        while(r - l > 1){
            int mid = (r+l)/2;
            if(a[mid] <= val){
                l = mid;
            }else{
                r = mid;
            }
        }
        return l == -1 ? -1 : a[l];
    }
    class SparseTable{
        int[][] rmq;
        int[] logTable;
        int n;
        SparseTable(int[] a){
            n = a.length;
            logTable = new int[n+1];
            for(int i = 2; i <= n; ++i){
                logTable[i] = logTable[i >> 1] + 1;
            }
            rmq = new int[logTable[n] + 1][n];
            for(int i=0; i<n; ++i){
                rmq[0][i] = a[i];
            }

            for(int k=1; (1 << k) < n; ++k){
                for(int i=0; i + (1 << k) <= n; ++i){
                    int max1 = rmq[k - 1][i];
                    int max2 = rmq[k-1][i + (1 << (k-1))];
                    rmq[k][i] = Math.max(max1, max2);
                }
            }
        }

        int max(int l, int r){
            int k = logTable[r - l];
            int max1 = rmq[k][l];
            int max2 = rmq[k][r - (1 << k) + 1];
            return Math.max(max1, max2);
        }
    }
    long checkBit(long mask, int bit){
        return (mask >> bit) & 1;
    }
    class Dsu{
        int[] parent;
        int countSets;
        Dsu(int n){
            countSets = n;
            parent = new int[n];
            for(int i=0; i<n; ++i){
                parent[i] = i;
            }
        }
        int findSet(int a){
            if(parent[a] == a) return a;
            parent[a] = findSet(parent[a]);
            return parent[a];
        }
        void unionSets(int a, int b){
            a = findSet(a);
            b = findSet(b);
            if(a!=b){
                countSets--;
                parent[a] = b;
            }
        }
    }
    static int checkBit(int mask, int bit) {
        return (mask >> bit) & 1;
    }
    boolean isLower(char c){
        return c >= 'a' && c <= 'z';
    }

    ////////////////////////////////////////////////////////////

    class SegmentTree{
        int[] t;
        int n;
        SegmentTree(int n){
            t = new int[4*n];
            build(new int[n+1], 1, 1, n);
        }
        void build (int a[], int v, int tl, int tr) {
            if (tl == tr)
                t[v] = a[tl];
            else {
                int tm = (tl + tr) / 2;
                build (a, v*2, tl, tm);
                build (a, v*2+1, tm+1, tr);
            }
        }

        void update (int v, int tl, int tr, int l, int r, int add) {
            if (l > r)
                return;
            if (l == tl && tr == r)
                t[v] += add;
            else {
                int tm = (tl + tr) / 2;
                update (v*2, tl, tm, l, Math.min(r,tm), add);
                update (v*2+1, tm+1, tr, Math.max(l,tm+1), r, add);
            }
        }

        int get (int v, int tl, int tr, int pos) {
            if (tl == tr)
                return t[v];
            int tm = (tl + tr) / 2;
            if (pos <= tm)
                return t[v] + get (v*2, tl, tm, pos);
            else
                return t[v] + get (v*2+1, tm+1, tr, pos);
        }
    }
    class Fenwik {
        long[] t;
        int length;

        Fenwik(int[] a) {
            length = a.length + 100;
            t = new long[length];

            for (int i = 0; i < a.length; ++i) {
                inc(i, a[i]);
            }
        }

        void inc(int ind, int delta) {
            for (; ind < length; ind = ind | (ind + 1)) {
                t[ind] += delta;
            }
        }

        long getSum(int r) {
            long sum = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += t[r];
            }
            return sum;
        }
    }
    int gcd(int a, int b){
        return b == 0 ? a : gcd(b, a%b);
    }

    long binPow(long a, long b, long m) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 1) {
            return ((a % m) * (binPow(a, b - 1, m) % m)) % m;
        } else {
            long c = binPow(a, b / 2, m);
            return (c * c) % m;
        }

    }
    int minInt(int... values) {
        int min = Integer.MAX_VALUE;
        for (int value : values) min = Math.min(min, value);
        return min;
    }

    int maxInt(int... values) {
        int max = Integer.MIN_VALUE;
        for (int value : values) max = Math.max(max, value);
        return max;
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        // TODO Auto-generated method stub
        new D().run();
    }

    void run() throws NumberFormatException, IOException {
        solve();
        out.close();
    };

    BufferedReader in;
    PrintWriter out;

    StringTokenizer tok;
    String delim = " ";
    Random rnd = new Random();

    D() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }

        }
        tok = new StringTokenizer("");
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine) {
                return null;
            }

            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken();
    }

    int readInt() throws NumberFormatException, IOException {
        return Integer.parseInt(readString());
    }
    byte readByte() throws NumberFormatException, IOException {
        return Byte.parseByte(readString());
    }
    int[] readIntArray (int n) throws NumberFormatException, IOException {
        int[] a = new int[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }

    Integer[] readIntegerArray (int n) throws NumberFormatException, IOException {
        Integer[] a = new Integer[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }

    long readLong() throws NumberFormatException, IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(readString());
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            long tmpHoles[];
            long holes[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readLong();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                //-> checking array copy... :D
//            tmpHoles = holes.clone();
//            tmpHoles = Arrays.copyOf(holes, holes.length);
                tmpHoles = Arrays.copyOfRange(holes, 0, holes.length);

                tmpHoles[i] = 0;//-> WA cz: I didn't add this stupid line...
                for (int j = 0; j < HOLES; j++) {
                    tmpHoles[j] += holes[i] / HOLES;
                }
                long stones = holes[i] % HOLES;
                int indx = i + 1;
                while (stones-- > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx++];
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if ((tmpHoles[j] & 1) == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;

public class Main {
    FastScanner in;
    PrintWriter out;

    private void solve() throws IOException {
        solveB();
    }

    long gcd(long a, long b) {
        while (a != 0 && b != 0) {
            if (a > b)
                a %= b;
            else
                b %= a;
        }
        return a + b;
    }

    class Pair implements Comparable<Pair> {
        long a, b;

        Pair(long aa, long bb) {
            a = aa;
            b = bb;
            long gcd = gcd(abs(a), abs(b));
            a /= gcd;
            b /= gcd;
            if (b < 0) {
                b = -b;
                a = -a;
            }
        }

        @Override
        public int compareTo(Pair o) {
            return a == o.a ? Long.compare(b, o.b) : Long.compare(a, o.a);
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair pair = (Pair) o;

            return a == pair.a && b == pair.b;
        }
    }

    private void solveD() throws IOException {
        int n = in.nextInt();
        long a = in.nextLong(), b = in.nextLong();
        long[] x = new long[n], y = new long[n];
        long[] vx = new long[n], vy = new long[n];
        long[] A = new long[n], B = new long[n], C = new long[n];
        Pair[] p = new Pair[n];

        for (int i = 0; i < n; i++) {
            x[i] = in.nextLong();
            y[i] = a * x[i] + b;
            vx[i] = in.nextLong();
            vy[i] = in.nextLong();
            A[i] = -vy[i];
            B[i] = vx[i];
            C[i] = -A[i] * x[i] - B[i] * y[i];
            p[i] = new Pair(A[i], B[i]);
        }

        long ans = 0;
        TreeMap<Pair, Integer> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            ans += i - map.getOrDefault(p[i], 0);
            map.put(p[i], map.getOrDefault(p[i], 0) + 1);
        }

        out.println(ans);
    }

    private void solveC() throws IOException {
        int n = in.nextInt(), q = in.nextInt();
        long[] a = new long[n], b = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
            b[i] = a[i];
            if (i > 0)
                b[i] += b[i - 1];
        }
        long[] k = new long[q];
        for (int i = 0; i < q; i++) {
            k[i] = in.nextLong();
        }
        int id = 0;
        long minus2 = 0;
        for (int i = 0; i < q; i++) {
            long minus = (id == 0) ? 0 : b[id - 1];
            int l = id, r = n;
            while (l + 1 < r) {
                int mid = (l + r) / 2;
                if (b[mid] - minus - minus2 > k[i]) {
                    r = mid;
                } else {
                    l = mid;
                }
            }
            if (b[l] - minus - minus2 > k[i]) {
                id = l;
                minus2 = a[l] - (b[l] - minus - minus2 - k[i]);
            } else {
                id = r;
                if (id == n) {
                    id = 0;
                    minus2 = 0;
                } else
                    minus2 = a[r] - (b[r] - minus - minus2 - k[i]);
            }
            out.println(n - id);
        }
    }

    private void solveB() throws IOException {
        int n = 14;
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }
        long max = 0;
        for (int i = 0; i < n; i++) {
            long cur = 0, pr = a[i] % n;
            if ((a[i] / n) % 2 == 0) {
                cur += a[i] / n;
            }
            for (int j = 1; j < n; j++) {
                int add = j <= pr ? 1 : 0;
                if ((a[(i + j) % n] + a[i] / n + add) % 2 == 0) {
                    cur += a[(i + j) % n] + a[i] / n + add;
                }
            }
            max = max(max, cur);
        }
        out.println(max);
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next().replace(',', '.'));
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }

    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}

import java.math.BigInteger;
import java.util.*;
import java.io.*;

public class solution {
    public static void merge(int arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    public static void sort(int arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        } else return gcd(b, a % b);
    }

    static class pair {
        int x;
        int y;

        public pair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    public static long lcm(long a, long b) {
        long v = a * b;
        long u = gcd(a, b);
        return v / u;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       long b[] = new long[14];
       StringTokenizer st = new StringTokenizer(br.readLine());
       for(int i=0;i<14;i++){
           b[i] = Long.parseLong(st.nextToken());
       }
       long max = -1;
       for(int i=0;i<14;i++){
           long a[] = Arrays.copyOf(b,14);
           long x = a[i];
           a[i] = 0;
           long c = x/14;
           long d = x%14;
           for(int j=0;j<14;j++){
               a[j]+=c;
           }
           int k = i+1;
           if(k == 14){
               k = 0;
           }
           while (d>0){
               a[k]++;
               k++;
               d--;
               if(k == 14){
                   k = 0;
               }
           }
           long sum = 0;
           for(int j=0;j<14;j++){
               if(a[j]%2 == 0){
                   sum+=a[j];
               }
           }
          max =  Math.max(max,sum);
       }
        System.out.println(max);
    }

    static class sort implements Comparator<ArrayList<Integer>> {

        @Override
        public int compare(ArrayList<Integer> o1, ArrayList<Integer> o2) {
            int c = o2.get(1).compareTo(o1.get(1));
            if(c == 0){
                c = o2.get(0).compareTo(o1.get(0));
            }
            return c;
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C_975_B {

    private long getMaxForI(final int i, final long[] array) {
        long[] copy = Arrays.copyOf(array, array.length);

        long remain = copy[i];

        copy[i] = 0;

        long dist = remain / 14;

        for (int j = 1; j <= 14; j++) {
            copy[(i + j) % 14] += dist;
            remain -= dist;
        }

        int j = 1;
        while (remain > 0) {
            copy[(i + j) % 14]++;
            remain--;
            j++;
        }

        long sum = 0;
        for (int k = 0; k < copy.length; k++) {
            if (copy[k] % 2 == 0) sum += copy[k];
        }
        return sum;

    }

    private void solve() throws IOException {

        long[] array = nextArrL(14);

        long max = 0;

        for (int i = 0; i < 14; i++) {
            if (array[i] > 0) {
                max = Math.max(getMaxForI(i, array), max);
            }
        }
        System.out.println(max);
    }

    public static void main(String[] args) {
        new C_975_B().run();
    }

    StringTokenizer tokenizer;
    BufferedReader reader;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextInt();
        return arr;
    }

    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextLong();
        return arr;
    }

    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextDouble();
        return arr;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Solution {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		long[] arr = new long[14];

		for (int i = 0; i < 14; i++) {
			arr[i] = sc.nextLong();
		}

		long max = 0;
		for (int i = 0; i < 14; i++) {
			long[] tempArray = new long[14];
			long res = 0;
			long temp = arr[i] % 14;
			for (int j = 0; j < 14; j++) {
				if (i == j) {
					tempArray[j] = arr[i] / 14;
				} else {
					tempArray[j] = arr[j] + arr[i] / 14;
				}
			}
			int index = (i + 1) % 14;
			while (temp-- > 0) {
				tempArray[index]++;
				index = (index + 1) % 14;
			}

			for (int j = 0; j < 14; j++) {
				if (tempArray[j] % 2 == 0)
					res += tempArray[j];
			}
			max = Math.max(res, max);
		}
		System.out.println(max);

	}

	static class Pair {
		int a;
		int b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream System) {
			br = new BufferedReader(new InputStreamReader(System));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() {
			for (long i = 0; i < 3e9; i++)
				;
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            long tmpHoles[];
            long holes[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readLong();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                tmpHoles = holes.clone();

                tmpHoles[i] = 0;//-> WA cz: I didn't add this stupid line...
                for (int j = 0; j < HOLES; j++) {
                    tmpHoles[j] += holes[i] / HOLES;
                }
                long stones = holes[i] % HOLES;
                int indx = i + 1;
                while (stones-- > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx++];
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if ((tmpHoles[j] & 1) == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;

public class Main {

    static long mod = 1000000007L;
    static FastScanner scanner;

    static int[] primes = {2,      3,      5,      7,     11,     13,     17,     19,     23,     29,
            31,     37,     41,     43,     47,     53,     59,     61,     67};
    static int[] masks = new int[71];
    static long[] results = new long[100010];
    static long[] pow2 = new long[100010];

    public static void main(String[] args) {
        scanner = new FastScanner();
        int n = 14;
        long[] a = scanner.nextLongArray(14);
        long res = 0;
        for (int i = 0; i < n; i++) {
            long[] b = Arrays.copyOf(a, a.length);
            long rs = a[i];
            if (rs == 0) continue;

            b[i] = 0;
            long rem = rs % 14;
            for (int j = 1; j <= rem; j++) {
                int pos = (i + j) % 14;
                b[pos] += 1;
            }

            long sum = 0;
            for (long x : b) {
                x += a[i] / 14;
                if (x % 2 == 0) sum += x;
            }
            res = Math.max(res, sum);
        }
        System.out.println(res);
    }

    static class Unit {
        long h;
        long d;
        int i;

        public Unit(long h, long d, int i) {
            this.h = h;
            this.d = d;
            this.i = i;
        }

        public long scoreForCast(int a) {
            long hh = h;
            for (int i = 0; i < a; i++) hh *= 2;
            return hh - d;
        }

        public long scoreForCastB() {
            return h - d;
        }
    }

    static class Segment implements Comparable<Segment> {
        int a;
        int b;
        int i;

        public Segment(int a, int b, int i) {
            this.a = a;
            this.b = b;
            this.i = i;
        }

        @Override
        public int compareTo(Segment o) {
            if (a == o.a) {
                return i - o.i;
            }
            return a - o.a;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException();
            }
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }

        int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) res[i] = nextInt();
            return res;
        }

        long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) res[i] = nextLong();
            return res;
        }

        String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) res[i] = nextToken();
            return res;
        }
    }

    static class PrefixSums {
        long[] sums;

        public PrefixSums(long[] sums) {
            this.sums = sums;
        }

        public long sum(int fromInclusive, int toExclusive) {
            if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");
            return sums[toExclusive] - sums[fromInclusive];
        }

        public static PrefixSums of(int[] ar) {
            long[] sums = new long[ar.length + 1];
            for (int i = 1; i <= ar.length; i++) {
                sums[i] = sums[i - 1] + ar[i - 1];
            }
            return new PrefixSums(sums);
        }

        public static PrefixSums of(long[] ar) {
            long[] sums = new long[ar.length + 1];
            for (int i = 1; i <= ar.length; i++) {
                sums[i] = sums[i - 1] + ar[i - 1];
            }
            return new PrefixSums(sums);
        }
    }

    static class ADUtils {
        static void sort(int[] ar) {
            Random rnd = ThreadLocalRandom.current();
            for (int i = ar.length - 1; i > 0; i--)
            {
                int index = rnd.nextInt(i + 1);
                // Simple swap
                int a = ar[index];
                ar[index] = ar[i];
                ar[i] = a;
            }
            Arrays.sort(ar);
        }

        static void reverse(int[] arr) {
            int last = arr.length / 2;
            for (int i = 0; i < last; i++) {
                int tmp = arr[i];
                arr[i] = arr[arr.length - 1 - i];
                arr[arr.length - 1 - i] = tmp;
            }
        }

        static void sort(long[] ar) {
            Random rnd = ThreadLocalRandom.current();
            for (int i = ar.length - 1; i > 0; i--)
            {
                int index = rnd.nextInt(i + 1);
                // Simple swap
                long a = ar[index];
                ar[index] = ar[i];
                ar[i] = a;
            }
            Arrays.sort(ar);
        }
    }

    static class MathUtils {
        static long[] FIRST_PRIMES = {
                2,     3,      5,      7,     11,     13,     17,     19,     23,     29,
                31,     37,     41,     43,     47,     53,     59,     61,     67,     71,
                73,     79,     83,     89  ,   97 ,    101,    103,    107,    109,    113,
                127,    131,    137,    139,    149,    151,    157,    163,    167,    173,
                179,    181,    191,    193,    197,    199,    211,    223,    227,    229,
                233,    239,    241,    251,    257,    263,    269,    271,    277,    281,
                283,    293,    307,    311,    313,    317,    331,    337,    347,    349,
                353,    359,    367,    373,    379,    383,    389,    397,    401,    409,
                419,    421,    431,    433,    439,    443,    449,    457,    461,    463,
                467,    479,    487,    491,    499,    503,    509,    521,    523,    541,
                547,    557,    563,    569,    571,    577,    587,    593,    599,    601,
                607,    613,    617,    619,    631,    641,    643,    647,    653,    659,
                661,    673,    677,    683,    691,    701,    709,    719,    727,    733,
                739,    743,    751,    757,    761,    769,    773,    787,    797,    809,
                811,    821,    823,    827,    829,    839,    853,    857,    859,    863,
                877,    881,    883,    887,    907,    911,    919,    929,    937,    941,
                947,    953,    967,    971,    977,    983,    991,    997,   1009,   1013,
                1019,   1021,   1031,   1033,   1039,   1049,   1051};

        static long[] primes(int to) {
            long[] all = new long[to + 1];
            long[] primes = new long[to + 1];
            all[1] = 1;
            int primesLength = 0;
            for (int i = 2; i <= to; i ++) {
                if (all[i] == 0) {
                    primes[primesLength++] = i;
                    all[i] = i;
                }
                for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {
                    all[(int) (i * primes[j])] = primes[j];
                }
            }
            return Arrays.copyOf(primes, primesLength);
        }

        static long modpow(long b, long e, long m) {
            long result = 1;

            while (e > 0) {
                if ((e & 1) == 1) {
                    /* multiply in this bit's contribution while using modulus to keep
                     * result small */
                    result = (result * b) % m;
                }
                b = (b * b) % m;
                e >>= 1;
            }

            return result;
        }

        static long submod(long x, long y, long m) {
            return (x - y + m) % m;
        }
    }
}

//4 - 1 * 6 * 2 = 12

//5 - 4 * 6 * 2 = 48
//5(2) - 4 * 1 * 6 * 1 = 24

//3 - 2 * 2 = 4
//4(1) - 3 * 2 * 2 = 12
//4(2) - 3 * 2 = 6

//--------------------
// 7 3
// 4 - 1 * 6 * 6 = 36 C(3,3)
// 5 - 1 *            c(4,3)
//                    c(5,3)

// 1
// 1

// 8 10 16
// 8 1
//1 17 1 0 0 0 0 0 0 21 0 0 0 0

import java.util.*;
import java.lang.*;

public class CF_20180501_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        // String in = "999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999";
        String[] input = in.split(" ");
        HashMap<Integer, Integer> orgMap = new HashMap<Integer, Integer>();
        long maxScore = 0;
        for (int i=0; i < input.length; i++) {
            orgMap.put(i, Integer.parseInt(input[i])); // pos, value pair
        }
        for (Map.Entry me : orgMap.entrySet()) {
            HashMap<Integer, Integer> tmpMap = new HashMap<Integer, Integer>(orgMap);
            Integer val = (Integer) me.getValue();
            if (val == 0) {
                continue;
            } else {
                Integer curPos = (Integer) me.getKey();
                tmpMap.put(curPos, (val/14));
// System.out.println("pos: " + curPos + ", curVal: " + tmpMap.get(curPos));
                long score = 0;
                for (int i=1; i < 14; i++) {
                    tmpMap.put((curPos+i)%14, tmpMap.get((curPos+i)%14)+((val/14) + (val % 14 >= i ? 1 : 0)));
// System.out.println("pos: " + (curPos+i)%14 + ", curVal: " + tmpMap.get((curPos+i)%14));
                }
                for (Map.Entry me2 : tmpMap.entrySet()) {
// System.out.print(me2.getValue() + " ");
                    score += (((Integer) me2.getValue() % 2 == 0) ? (Integer) me2.getValue() : 0);
                }
// System.out.println("");
                maxScore = maxScore > score ? maxScore : score;
// System.out.println("Score: " + score);
// System.out.println("Current max score: " + maxScore);
            }
        }
        System.out.println(maxScore);
        System.exit(0);
    }
}

import java.util.*;
public class B {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long[] a = new long[14];
        for (int i = 0; i < 14; i++)  a[i] = in.nextLong();
        long max = 0;
        for (int i = 0; i < 14; i++) {
            if (a[i] == 0)  continue;
            long[] b = new long[14];

            long base = a[i] / 14l;
            long remain = a[i] % 14l;

            for (int j = 0; j < 14; j++) {
                if (i == j)  b[j] = base;
                else  b[j] = a[j]+base;
            }

            for (int k = 1; k <= remain; k++) {
                int id = (k+i)%14;
                b[id]++;
            }

            long cur = 0;
            for (int j = 0; j < 14; j++) {
                if (b[j] % 2 == 0)  cur += b[j];
            }
            max = Math.max(max, cur);
//            System.out.println(i +" "+cur+" "+base+" "+remain);
        }
        System.out.println(max);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C{

	public static void main(String[] args)  throws Exception{
		Scanner sc = new Scanner (System.in);
		long [] a = new long [14];
		long max = 0;
		for(int i = 0 ; i< 14 ; i++)
			a[i] = sc.nextInt();

		for(int i = 0 ; i<14 ;i++)
		{
			long [] b = a.clone();
			long count = a[i];
			b[i] = 0;

			long every = count /14;
			long rem = count % 14;

			for(int j = 0 ; j<14 ;j++)
				b[j]+=every;

			for(int j = (i+1)%14 ; rem-->0 ;j= (j+1)%14)
				b[j]++;

			long res = 0 ;
			for(int j  =0 ; j<14 ;j++)
				if(b[j] % 2  == 0)
					res+=b[j];

			max = Math.max(res, max);

		}

		System.out.println(max);

	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.*;
public class Mancala {
	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		long[] a=new long[14];
		long[] b=new long[14];
		long sum=0,max=0;
		for(int i=0;i<14;i++)
		{
			b[i]=in.nextLong();
		}
		for(int i=0;i<14;i++)
		{
			for(int t=0;t<14;t++)
			{
				a[t]=b[t];
			}
			long temp=a[i];
			sum=0;
			a[i]=0;
			long fractionpart=temp/14;
			for(int j=0;j<14;j++) {
				a[j]=a[j]+fractionpart;
			}
			long y=temp%14;
			int next=i+1;
			for(long j=y;j>=1;j--)
			{
				a[next%14]++;
				next++;
			}
			for(int k=0;k<14;k++)
			{
				if(a[k]%2==0)
				{
					sum=sum+a[k];
				}
			}
			if(max<sum)
			{
				max=sum;
			}
		}
		System.out.println(max);
	}
}

import java.util.*;
public class B {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long[] a = new long[14];
		for(int i=0;i<14;i++){
			a[i] = sc.nextLong();
		}
		long max=Integer.MIN_VALUE;
		for(int i=0;i<14;i++){
			if(a[i]>0){
				long[] tema = new long[14];
				for(int k=0;k<14;k++){
					tema[k]=a[k];
				}
				long temp = a[i];
				int ii=i;
				long sum=0;
				long div = temp/14;
				long rem = temp%14;
				tema[i]=0;
				for(int j=0;j<14;j++){
					tema[j]=tema[j]+div;
				}
				for(int j=0;j<rem;j++){
					tema[(ii+j+1)%14] = tema[(ii+j+1)%14]+1;
				}
				for(int j=0;j<14;j++){
					if(tema[j]%2==0)
						sum+=tema[j];
				}
				if(sum>max)
					max=sum;
			}
		}
		System.out.println(max);
	}

}

import java.io.*;
import java.util.*;

public class UJP {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		final int n = 14;
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
			int[] b = a.clone();
			int can = b[i];
			b[i] = 0;
			int t = can / n;
			can %= n;
			for (int j = 0; j < n; j++)
				b[j] += t;
			int cur = (i + 1) % n;
			while (can != 0) {
				can--;
				b[cur]++;
				cur = (cur + 1) % n;
			}
			long curans = 0;
			for (int j = 0; j < n; j++)
				if (b[j] % 2 == 0)
					curans += b[j];
			ans = Math.max(ans, curans);
		}
		out.println(ans);
		out.close();
	}
	public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String nextString() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); }
                catch (IOException e) { throw new RuntimeException(e); }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public long nextLong() {
        	return Long.parseLong(nextString());
        }

        public double nextDouble() {
        	return Double.parseDouble(nextString());
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String args[]) throws IOException {
		Scanner sc=new Scanner (System.in);
		int arr[]=new int [14];
		long max=-1;
		for(int i=0;i<14;i++) {
			arr[i]=sc.nextInt();
		}
		int arro[]=arr.clone();
		for(int i=0;i<14;i++) {
			arr=arro.clone();
			int M=arr[i]/14;

			int rem=arr[i]%14;
			arr[i]=0;
			for(int j=0;j<14;j++)
				arr[j]+=M;
			int c=0;
			//System.out.println(rem);
			for(int j=i+1;c<rem;j++) {
				if(j==14)j=0;
				arr[j]++;c++;
				///System.out.println(Arrays.toString(arr));
			}

			long sum=0;
			for(int l=0;l<14;l++) {
				if(arr[l]%2==0)sum+=arr[l];
			}

			max=Math.max(sum, max);
			//System.out.println(sum);
		}
		System.out.println(max);

	}
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine(), ",| ");
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public boolean ready() throws IOException {return br.ready();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

	}}

import java.util.Arrays;
import java.util.Scanner;

public class macala {
public static void main(String[] args) {
	Scanner sc= new Scanner(System.in);
	long []elm =new long[14];
	for (int i = 0; i < elm.length; i++) {
		elm[i] = sc.nextInt();
	}
	long max = 0;
	for (int i = 0; i < elm.length; i++) {
//		System.out.println(Arrays.toString(elm));
		long [] tmp =Arrays.copyOf(elm, elm.length);
		long cur = tmp[i];
		tmp[i]= 0;
//		System.out.println(cur/14+" "+cur%14);
		for (int j = 0; j < tmp.length; j++) {
			tmp[j]+=cur/14;
		}
		cur-=(cur/14)*14;
		for (int j = i+1; j < tmp.length; j++) {
			if(cur==0)
				break;
			tmp[j]++;
			cur--;
		}
		for (int j = 0; j < i; j++) {
			if(cur==0)
				break;
			tmp[j]++;
			cur--;
		}
//		System.out.println(cur);
		long ansTmp =0;
		for (int j = 0; j < tmp.length; j++) {
			if(tmp[j]%2==0)
				ansTmp+=tmp[j];
		}
		max = Math.max(max, ansTmp);

	}
	System.out.println(max);
}
}

import java.util.*;

public class keks {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Long> a = new ArrayList<>();
        for (int i = 0; i < 14; i++) {
            a.add(in.nextLong());
        }
        long max = 0;
        for (int i = 0; i<14; i++) {
            ArrayList<Long> b = new ArrayList<>(a);
            long h = a.get(i);
            b.set(i, 0*h);
            if (h > 0) {
                long g = h/14;
                for (int k = 1; k<=14; k++) {
                    int index = (i+k)%14;
                    b.set(index, b.get(index) + g);
                }
                h %= 14;
                for (int k = 1; k<=h; k++) {
                    int index = (i+k)%14;
                    b.set(index, b.get(index) + 1);
                }
                long c = 0;
                for (int k = 0; k<14; k++) {
                    if (b.get(k) % 2 == 0) c += b.get(k);
                }
                if (c > max) max = c;
//                for (int k = 0; k < 14; k++) {
//                    System.out.print(b.get(k));
//                }
//                System.out.println();
            }
        }
        System.out.println(max);
    }
}

/*input
0 0 1 0 0 0 0 0 0 7 0 0 0 14

*/
import java.io.*;
import java.util.*;
public class Manchala
{
    static long find(long ans[],int in)
{
    long[] arr=new long[14];
    for(int i=0;i<14;i++)
        arr[i]=ans[i];
    long x=arr[in]/14;
    long y=arr[in]%14;
    // System.out.println(y);
    arr[in]=0;
    // System.out.println(x);
    for(int i=0;i<14;i++)
         arr[i]+=x;

    for(int c=0;c<y;c++)
    {
        arr[(c+in+1)%14]++;
    }
    // for(int i=0;i<14;i++)
    //     System.out.print(arr[i]+" ");
    // System.out.println();

    long sum=0;
    for(int i=0;i<14;i++)
    {
        if(arr[i]%2==0)
        {
            sum+=arr[i];
        }
    }
    return sum;
}
    public static void main(String[] args) throws Exception
    {
        Bolt sc=new Bolt(System.in);
        // int n=sc.nextInt();
        long[] arr=new long[14];
    for(int i=0;i<14;i++)
    {
        arr[i]=sc.nextInt();
    }
    long max=0;
    // for(int i=0;i<14;i++)
    // {
    //     if(arr[i]%2==0)
    //     {
    //         max+=arr[i];
    //     }
    // }
    // cout<<max;
    for(int i=0;i<14;i++)
    {
        if(arr[i]==0)
            continue;
        long x=find(arr,i);
        // System.out.print(arr[i]+" ");
        if(x>max)
            max=x;
    }
    System.out.println(max);
    }
}
class Bolt{

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        Bolt(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }

        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }

import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.io.*;
		public final class Solution {
		static PrintWriter out = new PrintWriter(System.out);
		static void flush() {
	 	out.flush();
	 	}
		static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;

	    public FastReader() {
	    br = new BufferedReader(new
	    InputStreamReader(System.in));
	    }
	    static boolean isPalindrome(String str1, String str2) {
	    String str3 = str1+str2;
	    int i = 0, j = str3.length()-1;
	    while(i < j) {
	    char a = str3.charAt(i), b = str3.charAt(j);
	    if(a != b) return false;
	    i++;j--;
	    }
	    return true;
	    }
	    static boolean isPalindrome(String str) {
	    int i = 0, j = str.length()-1;
	    while(i < j) {
	    char a = str.charAt(i), b = str.charAt(j);
	    if(a != b) return false;
	    i++;j--;
	    }
	    return true;
	    }
	    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());}
	    static int fact(int n) {
	    if(n == 1) return 1;
	    return n * fact(n-1);
	   	}
	    public int[] readIntArray(int n) {
	    int[] arr = new int[n];
		for(int i=0; i<n; ++i)
		arr[i]=nextInt();
		return arr;
		}
	    public int[][] readIntArray(int m, int n){
		int[][] arr = new int[m][n];
		for(int i = 0;i<m;i++)
		for(int j = 0;j<n;j++)
		arr[i][j] = nextInt();
		return arr;
	    }
	    public String[] readStringArray(int n) {
		String[] arr = new String[n];
		for(int i=0; i<n; ++i)
		arr[i]= nextLine();
		return arr;
	    }
		static int gcd(int a, int b) {
		if (b == 0) return a;
		return gcd(b, a % b);
		}
	    double nextDouble() {return Double.parseDouble(next());}
	    String nextLine() {
	    String str = "";
	    try{str = br.readLine();}
	    catch (IOException e) {e.printStackTrace();}
	    return str;}
	    }

		static long solve(int[] arr1) {
			int n = 14;
			long max = -1;

			for(int i = 0;i<n;i++) {
				int[] arr = new int[14];
				for(int k = 0;k<n;k++) {
					arr[k] = arr1[k];
				}
				int x = arr[i]%14;
				int y = arr[i]/14;
				arr[i] = 0;
				long res = 0;
				int j = 0;
				for(j = i+1;j<n;j++) {
					arr[j] += y;
				}
				for(j = 0;j<=i;j++) {
					arr[j] += y;
				}
				int k = j;
				while(x != 0) {
					if(k == n) {
						k = 0;
					}
					arr[k] += 1;
					x--;
					k++;
				}
				for(int l = 0;l<n;l++) {
					if(arr[l]%2 == 0) {
						res += arr[l];
					}
				}
				if(res > max) {
					max = res;
				}
			}
			return max;
		}
		public static void main(String args[]) throws Exception {
	    FastReader sc = new FastReader();
	    long start = System.currentTimeMillis();
	    int[] arr = sc.readIntArray(14);
		out.println(solve(arr));
	    flush();
	    long end = System.currentTimeMillis();
	    NumberFormat formatter = new DecimalFormat("#0.00000");
	    //System.out.print("Execution time is " + formatter.format((end - start) / 1000d) + " seconds");
	    }
	}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

import org.omg.PortableInterceptor.DISCARDING;
import org.xml.sax.ext.LexicalHandler;

public class Main implements Runnable{

		 public static void main(String[] args) throws IOException {
			new Thread(null , new Main(),"Main", 1<<26).start();

		 }

		public void run(){
			try {
			PrintWriter out = new PrintWriter(System.out);
			MyScanner sc = new MyScanner();
			solve(out, sc);
			out.close();
			}
			catch (Exception e) {
				e.printStackTrace();

			}
		}

		void solve(PrintWriter out, MyScanner sc){

			int n = 14;
			int[] a = new int[n];
			for(int i = 0 ; i < n ; ++i) {
				a[i] = sc.nextInt();
			}

			long score = 0;
			for(int i = 0; i < n ; ++i) {
				long val = 0;
				if(a[i] == 0) continue;
				int tour = a[i] / n;
				int r = a[i] % n;

				for(int  k = 1 ; k < n ; ++k) {
					int pos = (k + i) % n;
					int add = (k <= r)?1:0;
					if((a[pos] + tour + add) % 2 == 0) val += (a[pos] + tour + add);
				}

				if(tour % 2 == 0) val += tour;

				score = Math.max(score, val);
			}
			out.print(score);

		}

}

class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
       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;
    }

}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Arrays;
public class Test1{
    public static void main(String args[])throws IOException{
        Scanner sc=new Scanner(System.in);
        long b[]=new long[14];
        long a[]=new long[14];
        int i,j;
        long max=0,sum=0;
        for(i=0;i<14;i++)
        a[i]=sc.nextLong();
        for(i=0;i<14;i++)
        {
            int c=0;
            long temp=a[i];
            Arrays.fill(b,0);
            sum=0;
            for(j=i+1;j<14;j++)
            {
                b[c]=a[j]+temp/14;
                c++;
            }
            for(j=0;j<i;j++)
            {
                b[c]=a[j]+temp/14;
                c++;
            }
            b[c]=temp/14;
            for(j=0;j<temp%14;j++)
            b[j]++;
            for(j=0;j<14;j++)
            {
                if(b[j]%2==0)
                sum+=b[j];
            }
            max=Math.max(max,sum);
        }
        System.out.println(max);
    }
}

import java.io.*;
import java.util.*;
public class Codechef{
	static int max=Integer.MIN_VALUE;
	static int res=0;
	static int[] checkMax(int arr[],int j){
             int sum=0;
             int x=arr[j];
        		while(x!=0){
        		        if(j+1==15){
        		        	j=0;
        		        }else{
        		        	arr[j+1]=arr[j+1]+1;
        		        }
        		        // if(arr[j+1]%2==0){
        		        // 	sum=sum+arr[j+1];
        		        // 	if(sum>=max){
        		        // 	max=sum;
        		        // }
        		        // }

        		        x--;
        		        j++;
        		}
        		     return arr;

	}

    public static void main(String []args){
       Scanner sc = new Scanner (System.in);
    long a [] = new long [14];
    long b [] = new long [14];
    long p,q,r,s,max = 0;
    for(int i = 0; i < 14; i++) a[i] = sc.nextInt();
    for(int i = 0; i < 14; i++){
      p = a[i]%14;
      q = a[i]/14;
      r = 0;
      s = 0;
      for(int j = 0; j < 14; j++) b[j] = a[j];
      b[i] = 0;
      int j = (i+1)%14;
      for(; r < p; r++) {
        b[j]++;
        j=(j+1)%14;
      }
      for( j = 0; j < 14; j++) {
        b[j] += q;
        if(b[j] % 2 == 0) s+= b[j];
      }
      max = Math.max(max,s);
    }
    System.out.println(max);

    }

}

	import java.io.BufferedReader;

	import java.io.IOException;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.util.*;

	import javax.print.attribute.standard.QueuedJobCount;

	public class A {
		static int n;
		static TreeSet<Integer> Primes;
		static int[] arr;
		static int[] arr2;

		public static int[] copyOf(int[] arr) {
			for (int i = 0; i < arr.length; i++)
				arr2[i] += arr[i];
			return arr2;
		}

		public static long addEvens(int[] arr) {
			long r = 0;
			for (int i = 0; i < arr.length; i++)
				if (arr[i] % 2 == 0)
					r += arr[i];
			return r;
		}

		public static void main(String[] args) throws IOException {
			Scanner sc = new Scanner(System.in);
			PrintWriter pw = new PrintWriter(System.out);
			arr = new int[14];
			for (int i = 0; i < 14; i++) {
				arr[i] = sc.nextInt();
			}
			int x = 5535;
			int y = x;
			int s;
			long max = Integer.MIN_VALUE;
			for (int i = 0; i < 14; i++) {
				int a = arr[i];
				arr2 = new int[14];
				arr2 = copyOf(arr);
				arr2[i]=0;
				int j =0;
				int rem = arr[i] / 14;
				int steps = 0;
				int c = 0;
				for (  j = i+1;c<14; j++) {
					if (j >=14 )
						j = 0;
					arr2[c] += rem;
					c++;
				}
				steps = arr[i] % 14;
				j = i;
				c=0;
				int adasd;
				for ( j = i+1;c<steps; j++) {
					if (j >= 14)
						j = 0;
					arr2[j] += 1;
					c++;
				}
				max = Math.max(max, addEvens(arr2));
			}
			pw.print(max);

			pw.flush();
		}

	}

import java.util.*;

public class Main {
	public static void main(String[] main) {
		Scanner sc = new Scanner(System.in);
		long[] raw = new long[14];
		for (int i = 0; i < 14; i++) {
			raw[i] = sc.nextLong();
		}
		long max = 0;
		long[] nec = new long[14];
		for (int t = 0; t < 14; t++) {
			if(raw[t]==0) continue;
			for (int i = 0; i < 14; i++)
				nec[i] = raw[i];
			long num = raw[t];
			nec[t] = 0;
			long cycle = num / 14;
			for (int i = 0; i < 14; i++)
				nec[i] += cycle;
			num = num % 14;
			int indx = t + 1, last =(int) ((int)t + num);
			while (indx <= last) {
				nec[indx % 14] += 1;
				indx++;
			}

			long cnt = 0;
			for (int i = 0; i < 14; i++) {
				if (nec[i] % 2 == 0) {
					cnt += nec[i];
				}
			}
			if (cnt > max)
				max = cnt;
		}
		System.out.println(max);
	}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[14];
        for (int i = 0; i < 14; i++) a[i] = sc.nextInt();
        long max = 0;

        for (int i = 0; i < 14; i++){
            int[] b = new int[14];
            long counter = 0;
            for (int j = 0; j < 14; j++) b[j] = a[j];
            int c = b[i] / 14;
            int l = b[i];
            b[i] = 0;
            for (int j = 0; j < 14; j++) b[j] += c;
            for (int j = i + 1; j <= i + l % 14 ; j++){
                if (j > 13) b[j-14] ++;
                else b[j]++;
            }
            for (int j = 0; j < 14; j++) if (b[j] % 2 == 0) counter += b[j];
            if (max<counter) max = counter;
        }
        System.out.println(max);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int[] a = in.na(14);
            long ans = 0;
            for (int start = 0; start < 14; start++) {
                int[] b = Arrays.copyOf(a, 14);
                int num = a[start];
                b[start] = 0;
                for (int i = 0; i < 14; i++) {
                    b[i] += num / 14;
                }
                int rem = num % 14;
                for (int i = 1; i <= 14 && rem > 0; i++) {
                    int pos = (start + i) % 14;
                    b[pos]++;
                    rem--;
                }
                long sum = 0;
                for (int i = 0; i < 14; i++) {
                    if (b[i] % 2 == 0)
                        sum += b[i];
                }
                ans = Math.max(ans, sum);
            }
            out.println(ans);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

        public int[] na(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ni();
            return a;
        }

    }
}

import java.util.*;
import java.io.*;
public class Mancala {
  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 void main(String[]args){
      FastReader input = new FastReader();
      int[] arr = new int[14];
      for(int i = 0;i < 14;i++){
        arr[i] = input.nextInt();
      }
      int record = -1;
      long sum = 0;
     for(int i = 0;i < 14;i++){
        int[] arr2 = new int[arr.length];
        for(int a = 0;a < arr.length;a++){
          arr2[a] = arr[a];
        }
     /*   System.out.println("The array");
        for(int y : arr2){
          System.out.print(y + " ");
        }
        System.out.println(); */
     /*   for(int j = 0;j < arr2.length;j++){
          if(arr2[j] > 0 && j > record){
            record = j;
           // System.out.println("record = "+record);
            int p = arr2[j] / 14;
            int q = arr2[j] % 14;
            arr2[j] = 0;
            int key = j+1;
            if(key == 14) key = 0;
            int key2 = j+1;
            if(key2 == 14) key2 = 0;
            int count = 0;
            if(p > 0){
              while(count <= 14){
                arr2[key] = arr2[key] + p;
                key++;
                if(key == 14) key = 0;
                count++;
              }

            }
            if(q > 0){
              while(q > 0){
                arr2[key2++]++;
                q--;
                if(key2 == 14) key2 = 0;
              }
            }
            break;
          }
        } */
          for(int j = 0;j < arr2.length;j++){
            if(arr2[j] > 0 && j > record){
              record = j;
              int num = arr2[j];
              arr2[j] = 0;
              int p = j+1;
              int q = j + 1;
              if(p == 14) p = 0;
              if(q == 14) q = 0;
              int k = num / 14;
              int l = num % 14;
              int count1 = 0;
              if(k > 0){
                   while(count1 < 14){
                arr2[p] = arr2[p] + k;
                p++;
                if(p == 14) p = 0;
                count1++;
              }
              }

             if(l > 0){
               while(l > 0){
                 arr2[q++]++;
                 if(q == 14) q = 0;
                 l--;
               }
             }

              break;
            }
          }
        long sum2 = 0;
        for(int t : arr2){
      //    System.out.print(t + " ");
          if((t % 2) == 0){
            sum2 += t;
          }
        }
     //   System.out.println();
       if(sum2 > sum){
         sum = sum2;
       }
     }
     System.out.println(sum);

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            long tmpHoles[];
            long holes[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readLong();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                //-> checking array copy... :D
//            tmpHoles = Arrays.copyOf(holes, holes.length);
                tmpHoles = Arrays.copyOfRange(holes, 0, holes.length);
//            tmpHoles = holes.clone();

                tmpHoles[i] = 0;//-> WA cz: I didn't add this stupid line...
                for (int j = 0; j < HOLES; j++) {
                    tmpHoles[j] += holes[i] / HOLES;
                }
                long stones = holes[i] % HOLES;
                int indx = i + 1;
                while (stones-- > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx++];
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if ((tmpHoles[j] & 1) == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long tab[]=new long[14];
		for(int i=0;i<14;i++) {
			tab[i]=sc.nextLong();
		}
		long res=0;
		long tabb[]=new long[14];
		for(int j=0;j<14;j++) {
			if(tab[j]!=0) {
				for(int i=0;i<14;i++) {
					tabb[i]=tab[i];
				}
				int imax=j;
				long stones=tabb[imax];
				tabb[imax]=0;
				for(int i=0;i<14;i++) {
					tabb[i]+=stones/14;
				}
				stones=stones%14;
				while(stones!=0) {
					if(imax<13) {
						imax++;
						tabb[imax]++;
					}
					else {
						imax=0;
						tabb[imax]++;
					}
					stones--;
				}
				res=Math.max(res,calcule(tabb));
			}
		}
		System.out.println(res);
	}
	public static long calcule(long tab[]) {
		long res=0;
		for(int i=0;i<14;i++) {
			if(tab[i]%2==0) res+=tab[i];
		}
		return res;
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.HashMap;

public class b
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////
    //    RRRRRRRRR            AAA             HHH     HHH     IIIIIIIIIIIII   LLL           //
    //    RR    RRR           AAAAA            HHH     HHH      IIIIIIIIIII    LLL           //
    //    RR   RRR           AAAAAAA           HHH     HHH          III        LLL           //
    //    RR  RRR           AAA   AAA          HHHHHHHHHHH          III        LLL           //
    //    RRRRRR           AAA     AAA         HHHHHHHHHHH          III        LLL           //
    //    RR  RRR         AAAAAAAAAAAAA        HHH     HHH          III        LLL           //
    //    RR    RRR      AAA         AAA       HHH     HHH      IIIIIIIIIII    LLLLLLLLLLLL  //
    //    RR     RRR    AAA           AAA      HHH     HHH     IIIIIIIIIIIII   LLLLLLLLLLLL  //
    ///////////////////////////////////////////////////////////////////////////////////////////

    public static void main(String args[])
    {
        Reader sc=new Reader();
        PrintWriter out=new PrintWriter(System.out);
        int arr[]=new int[14];
        for(int i=0;i<14;i++)
        arr[i]=sc.i();
        long max=0;
        for(int i=0;i<14;i++)
        {
            int brr[]=new int[14];
            for(int j=0;j<14;j++)
            brr[j]=arr[j];
            int stones=brr[i];
            brr[i]=0;
            int pointer=i+1;
            int sumer=(stones)/14;
            stones%=14;
            while(stones-->0)
            {
                brr[pointer%14]++;
                pointer++;
            }
            long sum=0;
            for(int i1=0;i1<14;i1++)
                if(((long)brr[i1]+sumer)%2==0)
                sum+=(long)brr[i1]+sumer;
            max=Math.max(max,sum);
        }
        System.out.println(max);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

import org.omg.PortableInterceptor.DISCARDING;
import org.xml.sax.ext.LexicalHandler;

public class Main implements Runnable{

		 public static void main(String[] args) throws IOException {
			new Thread(null , new Main(),"Main", 1<<26).start();

		 }

		public void run(){
			try {
			PrintWriter out = new PrintWriter(System.out);
			MyScanner sc = new MyScanner();
			solve(out, sc);
			out.close();
			}
			catch (Exception e) {
				e.printStackTrace();

			}
		}

		void solve(PrintWriter out, MyScanner sc){

			int n = 14;
			int[] a = new int[n];
			for(int i = 0 ; i < n ; ++i) {
				a[i] = sc.nextInt();
			}

			long score = 0;
			for(int i = 0; i < n ; ++i) {
				long val = 0;
				if(a[i] == 0) continue;
				int tour = a[i] / n;
				int r = a[i] % n;

				for(int  k = 1 ; k <= r ; ++k) {
					int pos = (k + i) % n;
					if((a[pos] + tour + 1) % 2 == 0 ) val += (a[pos] + tour + 1);
				}
				for(int k = r + 1 ; k < n; ++k) {
					int pos = (k + i) % n;
					if((a[pos] + tour) % 2 == 0 ) val += (a[pos] + tour );
				}
				if(tour % 2 == 0) val += tour;

				score = Math.max(score, val);
			}
			out.print(score);

		}

}

class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
       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;
    }

}

import java.util.*;
public class B {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long[] a = new long[14];
		for(int i=0;i<14;i++){
			a[i] = sc.nextLong();
		}
		long max=Integer.MIN_VALUE;
		for(int i=0;i<14;i++){
			if(a[i]>0){
				long[] tema = new long[14];
				for(int k=0;k<14;k++){
					tema[k]=a[k];
				}
				long temp = a[i];
				int ii=i;
				long sum=0;
				long div = temp/14;
				long rem = temp%14;
				tema[i]=0;
				for(int j=0;j<14;j++){
					tema[j]=tema[j]+div;
				}
				for(int j=0;j<rem;j++){
					tema[(ii+j+1)%14] = tema[(ii+j+1)%14]+1;
				}
				for(int j=0;j<14;j++){
					if(tema[j]%2==0)
						sum+=tema[j];
				}
				if(sum>max)
					max=sum;
			}
		}
		System.out.println(max);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int[] board=fs.readArray(14);
		long max=0;
		for (int i=0; i<14; i++)
			max=Math.max(max, countPoints(board.clone(), i));
		System.out.println(max);
	}

	static long countPoints(int[] board, int toShare) {
		int[] toDist=new int[14];
		int oStones=board[toShare];
		for (int i=0; i<14; i++)
			toDist[i]=(oStones-i+13)/14;
		board[toShare]=0;
		for (int d=0; d<14; d++) {
			board[(toShare+1+d)%14]+=toDist[d];
		}
//		System.out.println(oStones);
//		System.out.println(Arrays.toString(toDist));
		long total=0;
		for (int i:board)
			if (i%2==0)
				total+=i;
//		System.out.println(Arrays.toString(board));
		return total;
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();

		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++)
				a[i]=nextInt();
			return a;
		}
	}

}

 import java.io.*;
    import java.util.*;

        public class Codeforces {

    		   public static long log2(long x)
    			{
    				long p=1;
    				long ans=0;
    				while(x>=p)
    				{
    					p*=2;
    					ans++;
    				}
    				return ans-1;
    			}

    		   public static void extendedgcd(int a, int b)
    		   {
    			   x=0;
    			   y=0;
    			   gc=0;
    			   xgcd(a,b);
    			   pw.println(a+"*"+x+" + "+b+"*"+y+" = "+gc);

    		   }

    		   public static long modex(long a, long b, long c)
    		   {
    			   if(b==0)
    				   return 1;
    			   else if(b==1)
    				   return a%c;
    			   else if(b%2==0)
    			   {
    				   	return modex((a*a)%c,b/2,c);
    			   }
    			   else
    			   {
    				   return (a*modex((a*a)%c,b/2,c))%c;

    			   }

    		   }

    		   public static void xgcd(int a, int b)
    		   {

    			   if(b==0)
    			   {
    				   x=1;
    				   y=0;
    				   gc=a;

    			   }
    			   else
    			   {
    				   xgcd(b,a%b);
    				   int temp = x;
    				   x=y;
    				   y = temp - ((a/b)*y);

    			   }
    		   }

    		   public static long gcd(long a, long b)
    		   {
    			   if(b==0)return a;
    			   else return gcd(b,a%b);

    		   }

    		   static int x,y,gc;

    		   static HashSet<Character> set;

    		   public static long expmod(long a, long b, long mod)
    		   {
    			   if(b==0)return 1;
    			   if(b==1)return a;

    			   if(b%2==0)
    			   {
    				   return ((expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    			   else
    			   {
    				   return ((a%mod)*(expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    		   }

    		   static class Comp implements Comparator<Point>
    		   {

				@Override
				public int compare(Point arg0, Point arg1) {

					if(arg0.x>arg1.x)return 1;
					if(arg0.x<arg1.x)return -1;
					return 0;
				}

    		   }

    		   static class STComp implements Comparator<Integer>
    		   {

				@Override
				public int compare(Integer arg0, Integer arg1) {

					return arg0.compareTo(arg1);
				}

    		   }

    		   static class Point
    		   {
    			   int x,y,ind;

    			    public Point(int a, int b)
    			    {
    			    	x=a;
    			    	y=b;
    			    	ind=0;
    			    }

    		   }

    		   public static boolean issub(String s1, String s2)
    		   {
    			   if(s1.length()>s2.length())
    			   return false;

    			   int l1 = s1.length();
    			   int l2 = s2.length();

    			   for(int i=0;i<=l2-l1;i++)
    			   {
    				   String sub = s2.substring(i, i+l1);
    				   if(s1.equals(sub))return true;
    			   }

    			   return false;
    		   }

    		   public static String enc(String s, int n)
    		   {
    			   String s1 = s.substring(0,n);
    			   String s2 = s.substring(n, s.length());

    			  String re="";
    			  for(int i=s1.length()-1;i>=0;i--)re+=s1.charAt(i);

    			  return re+s2;

    		   }

    		   static int vis[];

    		   public static void dfs(int x)
    		   {
    			   vis[x]=1;

    			   ArrayList<Integer> li = adj[x];

    			   for(int ch:li)
    			   {

    				   if(vis[ch]==0)dfs(ch);

    			   }

    		   }
    		   /*
    		   public static void dfsm(int x, HashSet<Integer> set)
    		   {
    			   vis2[x]=1;

    			   ArrayList<Integer> li = adj[x];

    			   for(int ch:li)
    			   {
    				   //if(!set.contains(ch))continue;
    				   if(vis2[ch]==0)dfsm(ch,set);

    			   }

    		   }
    		   */

    		   public static void countPaths(int s, int d, ArrayList<Integer> pa)
    		   {

    			   vis2[s]=1;
    			   if(s==d)
    			   {
    				   pa.add(s);
    				 //  paths[ct] = new ArrayList<Integer>(pa);
    				   ct++;
    			   }
    			   else
    			   {
    				   ArrayList<Integer> li = adj[s];
    				   pa.add(s);

    				   for(int ad: li)
    				   {
    					   if(vis2[ad]==0)countPaths(ad,d,pa);
    				   }

    			   }

    			   if(pa.size()>1)pa.remove(pa.size()-1);
    			   vis2[s]=0;
    			   return ;
    		   }

    		   public static boolean dif(String s1, String s2)
    		   {
    			   int ct=0;
    			   if(s1.length()!=s2.length())return false;
    			   for(int i=0;i<s1.length();i++)
    			   {
    				   if(s1.charAt(i)!=s2.charAt(i))ct++;

    			   }

    			   if(ct==1)return true;
    			   else return false;

    		   }

    		   static void add(int arr[], int N, int lo,
                       int hi, int val)
    		   {
							    arr[lo] += val;
							    if (hi != N - 1)
							       arr[hi + 1] -= val;
    		   }

// Utility method to get actual array from
// operation array
static void updateArray(int arr[], int N)
{
    // convert array into prefix sum array
    for (int i = 1; i < N; i++)
        arr[i] += arr[i - 1];
}

// method to print final updated array
static void printArr(int arr[], int N)
{
    updateArray(arr, N);
    for (int i = 0; i < N; i++)
        System.out.print(""+arr[i]+" ");
    System.out.print("\n");
}

    		  static int cyc;

    		  public static void dfsmod(int v, HashSet<Integer> set)
    		  {
    			  vis2[v]=1;

    			  ArrayList<Integer> li = adj[v];

    			  set.add(v);

    			  for(int ch: li)
    			  {
    				  if(set.contains(ch))
    				  {
    					  cyc=1;
    					  pw.println("** "+ch+" "+v);
    				  }
    				  if(vis2[ch]==0)dfsmod(ch,set);

    			  }

    			  set.remove(v);

    		  }

    		  	public static boolean isps(int x)
    		  	{
    		  		int sq = (int)Math.sqrt(x);

    		  		return sq>0&&sq*sq==x;

    		  	}

    		  	 public static void combinations(String suffix,String prefix)
    		  	 {
    		         if(prefix.length()<0)return;
    		         pw.println(suffix);

    		         for(int i=0;i<prefix.length();i++)
    		          combinations(suffix+prefix.charAt(i),prefix.substring(i+1,prefix.length()));

    		     }

    		  	 public static void topo(int x)
    		  	 {
    		  		 vis2[x]=1;
    		  		// pw.println("vis "+x);
    		  		 ArrayList<Integer> li = adj[x];
    		  		// pw.println(x+" has siz "+li.size());
    		  		// Integer i = x;
    		  		 for(int ch: li)
    		  		 {

    		  			 if(vis2[ch]==0)
    		  				 {topo(ch);
    		  				//pw.println(x+" "+ch);
    		  				 }
    		  		 }

    		  		 st.push(x);
    		  		 //pw.println(i+" pushed");
    		  	 }

    		 	static  ArrayList<Integer>[] adj;
    		 	static int[] vis2;
    		 	static int ct;

    		     public static void ch(Stack<Integer> s)
    		     {
    		    	 s.push(4);
    		    	 return;
    		     }

    		     static Stack<Integer> st;

    		  	 public static void main(String[] args)
    	   {

    		  		long arr[] = new long[14];

    		  		for(int i=0;i<14;i++)arr[i]=sc.nextLong();

    		  		long ans = Integer.MIN_VALUE;

    		  		long s1=0;

    		  		for(int j=0;j<14;j++)
		  			{
		  				if(arr[j]%2==0)s1+=arr[j];
		  			}
    		  		//ans = Math.max(s1, ans);
    		  		for(int i=0;i<14;i++)
    		  		{

    		  			long temp[] = new long[14];
    		  			for(int j=0;j<14;j++)temp[j]=arr[j];

    		  			long v = temp[i];
    		  			if(v==0)continue;

    		  			long q = v/14;
    		  			long r = v%14;

    		  			temp[i]=0;
    		  			int st = (i+1)%14;
    		  			for(int ct=0;ct<14;ct++)
    		  			{
    		  				temp[st]+=q;
    		  				st = (st+1)%14;
    		  			}

    		  			for(int ct=0;ct<r;ct++)
    		  			{
    		  				temp[st]+=1;
    		  				st = (st+1)%14;
    		  			}

    		  			long score=0;

    		  			for(int j=0;j<14;j++)
    		  			{
    		  				if(temp[j]%2==0)score+=temp[j];
    		  			}
    		  			/*
    		  			if(i==0)
    		  			{
    		  				for(int j=0;j<14;j++)
        		  			{
        		  				pw.print(temp[j]+" ");
        		  			}

    		  			}*/

    		  			//pw.println("** "+score);
    		  			ans = Math.max(score, ans);

    		  		}
    		  		//pw.println("***s");
    		  		 pw.println(ans);

    		  		 /*
    		  		st = new Stack<Integer>();

    			  cyc=0;
       			adj = new ArrayList[4];
       			vis2 = new int[4];

       			Arrays.fill(vis2, 0);
       			for(int i=0;i<4;i++)adj[i] = new ArrayList<Integer>();

       			adj[0].add(1);
       			adj[0].add(2);
       			adj[0].add(3);

       			adj[1].add(3);

       			//adj[2].add(0);
       			adj[2].add(1);
    			   //adj[3].add(2);

       			st = new Stack<Integer>();

       			topo(0);

    			 while(!st.isEmpty())pw.println(st.pop());
    			 */

    			/*
    			int n = sc.nextInt();

    			int arr[] = new int[n];

    			for(int i=0;i<n;i++)arr[i]=sc.nextInt();

    			long ansg =0,ansv = Long.MAX_VALUE;

    			int arr2[] = new int[n];
    			for(int i=0;i<n;i++)arr2[i]=arr[i]-i;

    			for(int i=0;i<n;i++)
    			{
    				int x = arr2[i];

    				if(x<=0)
    				{

    					if(i<ansv)
    					{

    						ansg=i;
    						ansv=i;
    					}
    				}
    				else
    				{
    					float t = ((float)x)/n;
    					long tt = (long)Math.ceil(t);

    					long ex = i;
    					long ti = tt*n+ex;

    					if(ti<ansv)
    					{
    						//pw.println("** "+i);
    						ansg=i;
    						ansv=ti;
    					}

    				}

    			}

    			pw.println(ansg+1);
    			*/

    			   /*ct=0;

    			paths= new ArrayList[10];
    			adj = new ArrayList[4];
    			vis2 = new int[4];

    			for(int i=0;i<4;i++)adj[i] = new ArrayList<Integer>();

    			for(int i=0;i<10;i++)paths[i] = new ArrayList<Integer>();

    			adj[0].add(1);
    			adj[0].add(2);
    			adj[0].add(3);

    			adj[1].add(3);

    			adj[2].add(0);
    			adj[2].add(1);

    			countPaths(2,3, new ArrayList<Integer>());
    			pw.println(ct);

    			for(int i=0;i<ct;i++)pw.println(paths[i]);
    			  */

    			   /*
    			   int n = sc.nextInt();
    			int m = sc.nextInt();

    			int arr[] = new int[n];

    			for(int i=0;i<n;i++)arr[i]=sc.nextInt();

    			int req = n/m;

    			int[] rem = new int[m];

    			HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
    			for(int i=0;i<n;i++)
    			{
    				rem[arr[i]%m]++;

    			}
    			int li=-1;
    			long ans=0;
    			for(int i=0;i<m;i++)
    			{
    				if(rem[i]>=req)
    				{
    					rem[(i+1)%m]+=rem[i]-req;
    					ans+=(rem[i]-req);
    				}
    				else
    				{
    					li=i;

    				}
    			}

    			for(int i=0;i<li;i++)
    			{
    				if(rem[i]>=req)
    				{
    					rem[(i+1)%m]+=rem[i]-req;
    					ans+=(rem[i]-req);
    				}
    				else
    				{
    					li=i;

    				}
    			}
    			pw.println(ans);
    			*/

    			   //pw.println(pa);
    		/*	  NGE
       		int[] sto = {100,80,60,70,60,75,85};
       		int n = sto.length;

       		int[] spa = new int[n];
       		spa[0]=1;

       		Stack<Integer> st = new Stack<Integer>();
       		st.push(0);

       		for(int i=1;i<n;i++)
       		{

       			while(!st.isEmpty()&&sto[st.peek()]<=sto[i])st.pop();

       			spa[i]=(st.isEmpty())?i+1:i-st.peek();
       			st.push(i);

       		}

       		for(int i=0;i<n;i++)pw.print(sto[i]+" ");
    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(spa[i]+" ");

    			   int[] nge = new int[n];

    			   st.clear();
    			   Stack<Point> st2 = new Stack<Point>();
    			   st2.push(new Point(sto[0],0));

    			   for(int i=1;i<n;i++)
    			   {
    				   while(!st2.isEmpty()&&st2.peek().x<sto[i])
    				   {
    					   Point pop = st2.pop();
    					   nge[pop.y]=sto[i];
    				   }
    				   st2.push(new Point(sto[i],i));

    			   }

    			   while(!st2.isEmpty())
    			   {
    				   nge[st2.pop().y]=-1;
    			   }

    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(sto[i]+" ");
    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(nge[i]+" ");
    			 */

    			   /*  int r = 2000000000;
    			  pw.println(r);
    			int n = sc.nextInt();
    			int k = sc.nextInt();
    			int l = sc.nextInt();
    			int m = n*k;
    			int arr[] = new int[m];

    			for(int i=0;i<m;i++)arr[i]=sc.nextInt();

    			Arrays.sort(arr);

    			int limit = l+arr[0];
    			int li=-1;

    			for(int i=0;i<m;i++)
    			{
    				//pw.println(arr[i]);
    				if(arr[i]>limit)
    				{
    					//pw.println(arr[i]);
    					li=i; break;
    				}
    			}
    			//pw.println(limit+" "+li);
    			if(li==-1)li=n;

    			int noofsmallest = li;

    			if(noofsmallest<n)
    			{
    				pw.println(0);
    			}
    			else
    			{
    				li--;
    				long ans=0;
    				for(int i=0;i<n-1;i++)
    				{
    					ans+=(long)arr[li];
    					li--;
    				}
    				ans+=arr[0];
    				pw.println(ans);

    			}
    			  */

    			pw.close();

    	   }

    		   static  class MyScanner
    			{

    			BufferedReader br;
    			StringTokenizer st;

    			public MyScanner()
    			{
    				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;
    			}

    		}

    		static MyScanner sc = new  MyScanner();
    		static PrintWriter pw = new PrintWriter(System.out, true);

    		static class DisjointSet
    		{
    			int[] parent;
    			int[] rank;
    			int n;

    			public DisjointSet(int x)
    			{
    				n=x;
    				parent = new int[x];
    				rank = new int[x];

    				for(int i=0;i<n;i++)
    				{
    					parent[i]=i;
    				}

    			}

    			public int find(int x)
    			{

    				if(parent[x]==x)
    					return x;
    				else
    					return find(parent[x]);
    			}

    			public void union(int i, int j)
    			{
    				int iroot = find(i);
    				int jroot = find(j);

    				if(iroot==jroot)
    					return;

    				if(rank[iroot]<rank[jroot])
    				{
    					parent[iroot]=jroot;

    				}
    				else if(rank[jroot]<rank[iroot])
    				{
    					parent[jroot]=iroot;
    				}
    				else
    				{
    					parent[iroot]=jroot;
    					rank[jroot]++;

    				}

    			}

    		}

    	}

import java.util.Arrays;
import java.util.Scanner;

public class cf975b {

	public static void main(String[] args) {
		Scanner sc=  new Scanner(System.in);

		long[] a = new long[14];

		long max = 0;
		for (int i =0 ; i < 14; i++) {
			a[i] = sc.nextLong();

			if (a[i] % 2 == 0) {
				max += a[i];
			}
		}

		for (int i =0 ; i < 14; i++) {
			if (a[i] % 2 == 1) {
				long[] copy = Arrays.copyOf(a, 14);

				max = Math.max(max, change(copy,i));
			}
		}

		System.out.println(max);
	}

	public static long change(long[] arr, int pos) {
		long ret = 0;

		long per = arr[pos]/14;

		long[] adder = new long[14];

		for (int i = 0; i < 14; i++) {
			adder[i] = per;
		}

//		if (arr[pos]%14 != 0) {
//			moves+= arr[pos]%14;
//		}

		long mod = arr[pos]%14;

		int idxadder = 0;
		idxadder %= 14;
		while (mod > 0) {
			adder[idxadder]++;
			idxadder++;
			idxadder %= 14;
			mod--;
		}

		arr[pos] = 0;

		int idx = pos+1;
		idxadder = 0;
		idx %= 14;
		long moves = 14;
		while (moves > 0) {
			arr[idx] += adder[idxadder];
			idx++;
			idx %= 14;
			idxadder++;
			idxadder %= 14;
			moves--;
		}

		for (int i =0 ; i < 14; i++) {
			if (arr[i] % 2 == 0) {
				ret += arr[i];
			}
		}

		return ret;
	}

}

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Mancala {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s = new Scanner(System.in);
		int[] arr = new int[14];
         // int[] brr = new int[14];

		for (int i = 0; i < 14; i++) {
			arr[i] = s.nextInt();
             //brr[i] = arr[i];
		}
		long ans = 0;
		for (int i = 0; i < 14; i++) {
			//brr[i] = arr[i];
			if (arr[i] > 0) {
                 int[] brr = Arrays.copyOf(arr, arr.length);

				int rem = brr[i] % 14;
				int q = brr[i] / 14;
				brr[i] = 0;
				for (int j = 1; j <= 14; j++) {
					brr[(i + j) % 14] += q;
				}
				for (int j = 1; j <= rem; j++) {
					brr[(i + j) % 14]++;
				}

				long sum = 0;
				for (int j = 0; j < brr.length; j++) {

					if (brr[j] % 2 == 0) {
						sum += brr[j];
						ans = Math.max(ans, sum);
					}
				}

			}

		}

		System.out.println(ans);

	}

}

import java.io.*;
public class Mancala
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input[] = br.readLine().split(" ");
        int a[] = new int[input.length];
        int b[] = new int[input.length];
        for(int i=0;i<input.length;i++)
        {
            a[i] = Integer.parseInt(input[i]);
            b[i] = a[i];
        }
        int n = input.length;
        long max = 0;
        int flag = 0;
        while(flag<n)
        {
            for(int i=0;i<n;i++)
                a[i] = b[i];
            if(a[flag] > 0)
                max = Math.max(max,answer(a,n,flag));
            flag++;
        }
        System.out.println(max);
    }
    static long answer(int a[],int n,int pos)
    {
        int val = a[pos]; // iterate over val
        int q = val/n;
        for(int i=0;i<n;i++)
            if(i == pos)
                a[i] = q;
            else
                a[i] += q;
        val %= n;
        // a[pos] = 0;
        if(pos + val + 1 <= n)
            for(int i = pos + 1;i<pos + val + 1;i++)
                a[i]++;
        else
        {
            for(int i = pos + 1;i<n;i++)
                a[i]++;
            for(int i=0;i<pos + val + 1 - n;i++)
                a[i]++;
        }
        /*for(int i=0;i<n;i++)
            System.out.print(a[i] + " ");
        System.out.println();*/
        long ct = 0;
        for(int i=0;i<n;i++)
            if(a[i] % 2 == 0)
                ct += 1L * a[i];
        return ct;
    }
}

//package CodeForces;

/*In the name of Allah the Most Merciful.
 * Author
 * Md. Toufiqul Islam
 * Dept. Of CSE
 * Ahsanullah University Of Science And Technology
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class R478B {
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        long[] arr = sc.nextLongArray(14);
        long[] save = new long[14];

        long max = 0;

        for(int i=0;i<arr.length;i++){
            for(int j=0;j<arr.length;j++){
                save[j] = arr[j];
            }
            if(save[i]>0){
                long[] myarr = playMancala(save,i);
                max = Math.max(max,getEvenNumberOfStone(myarr));
              /* out.println(myarr);
               out.println(arr);*/

            }
        }

        out.println(max);

        out.close();

    }

    public static long[]  playMancala(long[] myArr,int start){

        long count = myArr[start];
        myArr[start] = 0;

        if(count<=14) {
            int pos = start + 1;
            while (count != 0) {
                if (pos == 14) {
                    pos = 0;
                }
                myArr[pos] += 1;
                count--;
                pos++;

            }
        }
        else{
            long per = (long) Math.floor(count/(double)14);
            long total = per*14;

            int pos = start+1;
            while (total!=0){
                if(pos==14){
                    pos=0;
                }
                myArr[pos]+=per;
                total -=per;
                pos++;
            }

            long remaining = count-(per*14);

            while (remaining!=0){
                if(pos==14){
                    pos=0;
                }
                myArr[pos]+=1;
                remaining -=1;
                pos++;
            }

        }

      /*  for(int i=0;i<myArr.length;i++){
            System.out.print(myArr[i]+" ");
        }

        System.out.println();*/

        return myArr;
    }

    public  static long getEvenNumberOfStone(long[] arr){
        long total =0;
        for(int i=0;i<arr.length;i++){
            if(arr[i]%2 == 0){
                total += arr[i];
            }
        }

        return total;
    }

    public static class InputReader {
        private boolean finished = false;

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1) {
                return -1;
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private String readLine0() {
            StringBuilder buf = new StringBuilder();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r') {
                    buf.appendCodePoint(c);
                }
                c = read();
            }
            return buf.toString();
        }

        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0) {
                s = readLine0();
            }
            return s;
        }

        public String readLine(boolean ignoreEmptyLines) {
            if (ignoreEmptyLines) {
                return readLine();
            } else {
                return readLine0();
            }
        }

        public BigInteger readBigInteger() {
            try {
                return new BigInteger(nextString());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }

        public char nextCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, nextInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public boolean isExhausted() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1) {
                read();
            }
            return value == -1;
        }

        public String next() {
            return nextString();
        }

        public SpaceCharFilter getFilter() {
            return filter;
        }

        public void setFilter(SpaceCharFilter filter) {
            this.filter = filter;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
        public int[] nextIntArray(int n){
            int[] array=new int[n];
            for(int i=0;i<n;++i)array[i]=nextInt();
            return array;
        }
        public int[] nextSortedIntArray(int n){
            int array[]=nextIntArray(n);
            Arrays.sort(array);
            return array;
        }
        public int[] nextSumIntArray(int n){
            int[] array=new int[n];
            array[0]=nextInt();
            for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
            return array;
        }
        public long[] nextLongArray(int n){
            long[] array=new long[n];
            for(int i=0;i<n;++i)array[i]=nextLong();
            return array;
        }
        public long[] nextSumLongArray(int n){
            long[] array=new long[n];
            array[0]=nextInt();
            for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();
            return array;
        }
        public long[] nextSortedLongArray(int n){
            long array[]=nextLongArray(n);
            Arrays.sort(array);
            return array;
        }
    }
    public static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(char[] array) {
            writer.print(array);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void print(int[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void print(double[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void print(long[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void println(int[] array) {
            print(array);
            writer.println();
        }

        public void println(double[] array) {
            print(array);
            writer.println();
        }

        public void println(long[] array) {
            print(array);
            writer.println();
        }

        public void println() {
            writer.println();
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void print(char i) {
            writer.print(i);
        }

        public void println(char i) {
            writer.println(i);
        }

        public void println(char[] array) {
            writer.println(array);
        }

        public void printf(String format, Object... objects) {
            writer.printf(format, objects);
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

        public void print(long i) {
            writer.print(i);
        }

        public void println(long i) {
            writer.println(i);
        }

        public void print(int i) {
            writer.print(i);
        }

        public void println(int i) {
            writer.println(i);
        }

        public void separateLines(int[] array) {
            for (int i : array) {
                println(i);
            }
        }
    }

}

import java.util.Arrays;
import java.util.Scanner;

public class solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = 14;
		long max = 0;
		long[] ar = new long[14];
		for(int i=0;i<n;i++){
			ar[i]=in.nextInt();
		}
		for(int i = 0; i<n;i++){
			long temp[] = new long[14];
			for(int j=0;j<n;j++){
				temp[j]=ar[j];
			}
			long m = ar[i];
			if(m>0){
				temp[i]=0;
				long a = m/14;
				long r = m%14;
				for(int j = 0;j<n;j++){
					temp[j]+=a;
				}

				int tempi = i;
				for(int j=0;j<r;j++){

					if(tempi==13){
						temp[0]+=1;
						tempi=0;
					}else{
						temp[tempi+1]+=1;
						tempi++;
					}
				}
				long tempm=0;

				for(int j=0;j<n;j++){
					if(temp[j]%2==0){
						tempm+=temp[j];
					}
				}

				if(max<tempm){

					max = tempm;}
			}

		}

		System.out.println(max);

	}

}

import java.io.*;
import java.util.StringTokenizer;

public class B {

    FastScanner scanner;
    PrintWriter writer;

    void solve() throws IOException {
        scanner = new FastScanner(System.in);
        writer = new PrintWriter(System.out);

        int n = 14;
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scanner.nextInt();

        long max = 0;

        for (int i = 0; i < n; i++) {
            if (a[i] > 0)
                max = Math.max(max, move(a, i));
        }

        writer.println(max);

        writer.close();
    }

    long move(int[] a, int i) {
        long sum = 0;

        int n = a.length;

        for (int j = 0; j < n; j++) {
            int aj;
            int off;

            if (i != j) {
                aj = a[j];
                off = (j - i + n) % n;
            } else {
                aj = 0;
                off = n;
            }

            if (a[i] >= off) {
                aj++;
                aj += (a[i] - off) / n;
            }

            if (aj % 2 == 0)
                sum += aj;
        }

        return sum;
    }

    public static void main(String... args) throws IOException {
        new B().solve();
    }

    static class FastScanner {

        BufferedReader br;
        StringTokenizer tokenizer;

        FastScanner(String fileName) throws FileNotFoundException {
            this(new FileInputStream(new File(fileName)));
        }

        FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        String nextLine() throws IOException {
            tokenizer = null;
            return br.readLine();
        }

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = br.readLine();
                if (line == null) {
                    return null;
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

import java.util.Scanner;

//http://codeforces.com/contest/975/problem/B
public class slots14 {

	public static void main(String[] args) {
		long a[] = new long[14];
		Scanner scan = new Scanner(System.in);
		for (int i = 0; i < 14; i++)
			a[i] = scan.nextLong();
		scan.close();
		long max = 0;
		for (int i = 0; i < 14; i++) {
			long arr[] = new long[14];
			for (int j = 0; j < 14; j++) {
				arr[j] = a[j];
			}
			long x = arr[i];
			arr[i] = 0;
			for (int j = 0; j < 14; j++) {
				arr[j] += (x / 14);
			}
			long remain = (x % 14);
			for (int j = i + 1; j < 14; j++) {
				if (remain > 0) {
					arr[j]++;
					remain--;
				}
			}
			for (int j = 0; j < i; j++) {
				if (remain > 0) {
					arr[j]++;
					remain--;
				}
			}
			long sum = 0;
			for (int j = 0; j < 14; j++) {
				if ((arr[j] % 2) == 0) {
					sum += arr[j];
				}
			}
			/*
			 * for (long k : arr) { System.out.print(k + " "); } System.out.println();
			 */
			if (sum >= max) {
				max = sum;
			}
		}
		System.out.print(max);
	}
}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Arrays;
public class Test1{
    public static void main(String args[])throws IOException{
        Scanner sc=new Scanner(System.in);
        long b[]=new long[14];
        long a[]=new long[14];
        int i,j;
        long max=0,sum=0;
        for(i=0;i<14;i++)
        a[i]=sc.nextLong();
        for(i=0;i<14;i++)
        {
            int c=0;
            long temp=a[i];
            Arrays.fill(b,0);
            sum=0;
            for(j=i+1;j<14;j++)
            {
                b[c]=a[j]+temp/14;
                c++;
            }
            for(j=0;j<i;j++)
            {
                b[c]=a[j]+temp/14;
                c++;
            }
            b[c]=temp/14;
            for(j=0;j<temp%14;j++)
            b[j]++;
            for(j=0;j<14;j++)
            {
                if(b[j]%2==0)
                sum+=b[j];
            }
            max=Math.max(max,sum);
        }
        System.out.println(max);
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a[] = new long[14];
        long pro[] = new long[14];
        for (int i =0;i<14;i++){
            a[i] = in.nextInt();
        }

        long ans=0;

        for (int i=0;i<14;i++){
            for (int j=0;j<14;j++){
                pro[j] = a[j];
            }
            long temp = pro[i];
            pro[i] = 0;
            for (int j=0;j<14;j++){
                pro[j]+=(temp/14);
            }//先加一遍

            int k=i+1;

            temp%=14;
            while (temp!=0){
                if (k==14)
                    k=0;
                pro[k++]++;
                temp--;

            }

            long sum = 0;
            for (int j=0;j<14;j++){
                if (pro[j]%2==0){//装逼的话可以用按位与
                    sum+=pro[j];
                }
            }
            ans = max(sum,ans);
        }

        System.out.println(ans);
    }
    public static long max(long a,long b){
        return a>b?a:b;
    }
}

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());
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            long tmpHoles[];
            long holes[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readLong();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                //-> checking array copy... :D
                tmpHoles = holes.clone();
//            tmpHoles = Arrays.copyOf(holes, holes.length);
//            tmpHoles = Arrays.copyOfRange(holes, 0, holes.length);

                tmpHoles[i] = 0;//-> WA cz: I didn't add this stupid line...
                for (int j = 0; j < HOLES; j++) {
                    tmpHoles[j] += holes[i] / HOLES;
                }
                long stones = holes[i] % HOLES;
                int indx = i + 1;
                while (stones-- > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx++];
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if ((tmpHoles[j] & 1) == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;

public class Solution {

    public static long[] toLongArrFromStringArr(String[] arr) {
        return Arrays.stream(arr).mapToLong(new ToLongFunction<String>() {
            @Override
            public long applyAsLong(String value) {
                return Long.parseLong(value);
            }
        }).toArray();
    }

    public static long solve(final long [] arr, final int MAX) {
        long result = 0;
        for (int i = 0; i < MAX; i++) {
            long[] tempArr = new long[MAX];
            System.arraycopy(arr, 0, tempArr, 0, MAX);
            long remaining = arr[i] % MAX;
            long extraCount = arr[i] / MAX;
            tempArr[i] = 0;
            int j = i + 1;
            while (remaining > 0) {
                j %= MAX;
                tempArr[j]++;
                j++;
                remaining--;
            }
            if (extraCount > 0) {
                for (int k = 0; k < MAX; k++) {
                    tempArr[k] += extraCount;
                }
            }
//            System.out.println(Arrays.toString(tempArr));
            long evenSum = 0;
            for (long k : tempArr) {
                if(k % 2 == 0) {
                    evenSum += k;
                }
            }
            result = Math.max(result, evenSum);
        }
        return result;
    }

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println(solve(toLongArrFromStringArr(br.readLine().split(" ")), 14));
    }
}

import java.util.Scanner;

public class B975 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] A = new int[14];
        for (int i=0; i<14; i++) {
            A[i] = in.nextInt();
        }
        long max = 0;
        for (int from=0; from<14; from++) {
            int a = A[from];
            int remains = a/14;
            long score = (remains%2 == 0) ? remains : 0;
            for (int i=1; i<14; i++) {
                int count = A[(from+i)%14] + (a+14-i)/14;
                if (count%2 == 0) {
                    score += count;
                }
            }
            max = Math.max(max, score);
        }
        System.out.println(max);
    }

}

/*
 * UMANG PANCHAL
 * DAIICT
 */

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.Comparator;
public class Main
{

	private static final Comparator<? super Integer> Comparator = null;
	static LinkedList<Integer> adj[];
	static ArrayList<Integer> adj1[];
	static int[] color,visited1;
	static boolean b[],visited[],possible;
	static int level[];
	static Map<Integer,HashSet<Integer>> s;
	static int totalnodes,colored;
	static int count[];
	static long sum[];
	static int nodes;
	static long ans=0;
	static long[] as=new long[10001];
	static long c1=0,c2=0;
	static int[] a,d,k;
	static int max=100000000;
	static long MOD = 1000000007,sm=0,m=Long.MIN_VALUE;
	static boolean[] prime=new boolean[1000005];
	static int[] levl;
    static int[] eat;
    static int price[];
    static int res[],par[],co[];
    static int result=0;
    static int[] root,size,du,dv;
    static long p=Long.MAX_VALUE;
    static int start,end,r=0;
    static boolean[] vis1,vis2;
    static int to;

	// --------------------My Code Starts Here----------------------

	public static void main(String[] args) throws IOException
	{
		in=new InputReader(System.in);
	    w=new PrintWriter(System.out);

	    long[] a=new long[14];
	    for(int i=0;i<14;i++)
	    	a[i]=nl();
	    long max=-1;
	    //long[] d=a;
	    for(int i=0;i<14;i++)
	    {

	    	long[] d=new long[14];
	    	for(int j=0;j<14;j++)
	    		d[j]=a[j];
	    	long p=a[i]/14L;
	    	d[i]=0;
	    	for(int j=0;j<14;j++)
	    		d[j]+=p;
	    	long r=a[i]%14L;
	    	for(int j=1;j<=r;j++)
	    		d[(i+j)%14]+=1L;
	    	long ans=0;
	    	for(int j=0;j<14;j++)
	    	{
	    		if(d[j]%2==0)
	    			ans+=d[j];
	    	}
	    	//for(int j=0;j<14;j++)
	    		//w.print(d[j]+" ");
	    	//w.println(ans+" "+i);
	    	max=Math.max(max,ans);

	    //	w.println();
	    }
	    w.print(max);
   w.close();
   }

	// --------------------My Code Ends Here------------------------

	public static void dfs(int n)
	{
		visited[n]=true;
		for(int i:adj[n])
		{
			if(!visited[i])
			{
				dfs(i);
				if(size[i]%2==1)
					size[n]+=size[i];
				else
					to++;
			}
		}
		size[n]++;
	}

	/*
	 *  PriorityQueue<Integer> pq = new PriorityQueue<Integer>(new Comparator<Integer>()
  			{
  				public int compare(Integer o1, Integer o2)
  				{
  					return Intege
  					r.compare(o2,o1);
  				}
  			});
	 *
	 *
	 */

	public static void shuffle(long[] a,int n)
	{
		Random r=new Random();
		for(int i=n-1;i>0;i--)
		{
			int j=r.nextInt(i);
			long t=a[j];
			a[j]=a[i];
			a[i]=t;
		}
	}
	public static void bfs1(int u)
	{
	    Queue<Integer> q=new LinkedList();
	    q.add(u);
	    visited[u]=true;
	    while(!q.isEmpty())
	    {
	    	//w.print(1);
	    	int p=q.poll();
	      for(int i=0;i<adj[p].size();i++)
	     {
	    	  if(!visited[adj[p].get(i)])
	    	  {
	    	q.add(adj[p].get(i));
	    	visited[adj[p].get(i)]=true;
	    	  }
	    	  levl[adj[p].get(i)]=levl[p]+1;
	    	  }
	    }

	}
	public static void bfs2(int u)
	{
	    Queue<Integer> q=new LinkedList();
	    q.add(u);
	    vis2[u]=true;
	    while(!q.isEmpty())
	    {
	    	int p=q.poll();
	      for(int i=0;i<adj[p].size();i++)
	     {
	    	  if(!vis2[adj[p].get(i)])
	    	  {
	    	dv[adj[p].get(i)]=dv[p]+1;
	    	q.add(adj[p].get(i));

	    	vis2[adj[p].get(i)]=true;
	    	  }
	    	  }
	    }

	}
	 public static void buildgraph(int n)
	 {
         adj=new LinkedList[n+1];
         visited=new boolean[n];
         level=new int[n];
         par=new int[n];
         for(int i=0;i<=n;i++)
         	{
        	 adj[i]=new LinkedList<Integer>();

         	}

	 }

	/*public static long kruskal(Pair[] p)
	{
		long ans=0;
		int w=0,x=0,y=0;
		for(int i=0;i<p.length;i++)
		{
			w=p[i].w;
			x=p[i].x;
			y=p[i].y;
			if(root(x)!=root(y))
			{
				ans+=w;
				union(x,y);
			}
		}
		return ans;
	}*/

	 static class Pair implements Comparable<Pair>
	 {
		 Long x,w;
		 Integer ind;
	        Pair(long x,long w,int ind)
	        {
	            this.x=x;
	            this.w=w;
	            this.ind=ind;
	        }
	        public int compareTo(Pair p)
	        {
	            return Long.compare(this.w,p.w);
	        }

	}
	 static  class npair implements Comparable<npair>
	 {
	     int a,b;

		npair(int a,int b)
		{
			this.a=a;
			this.b=b;
			//this.index=index;
		}

		public int compareTo(npair o) {
			// TODO Auto-generated method stub
			return Integer.compare(this.a,o.a);
		}

	}
	public static int root(int i)
	{
		while(root[i]!=i)
		{
			root[i]=root[root[i]];
			i=root[i];
		}
		return i;
	}

	public static void init(int n)
	{
		root=new int[n+1];
		for(int i=1;i<=n;i++)
			root[i]=i;
	}
	public static void union(int a,int b)
	{
	    int root_a=root(a);
	    int root_b=root(b);
	    root[root_a]=root_b;
	   // size[root_b]+=size[root_a];
	}

	public static boolean isPrime(long n)
	{
	    // Corner cases
	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    // This is checked so that we can skip
	    // middle five numbers in below loop
	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (long i=5; i*i<=n; i=i+6)
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;

	    return true;
	}

	public static String ns()
	{
		return in.nextLine();
	}
	public static int ni()
	{
		return in.nextInt();
	}
	public static long nl()
	{
		return in.nextLong();
	}
	public static int[] na(int n)
	{
		int[] a=new int[n];
		for(int i=0;i<n;i++)
		a[i]=ni();
		return a;
	}
	public static long[] nla(int n)
	{
		long[] a=new long[n];
		for(int i=0;i<n;i++)
		a[i]=nl();
		return a;
	}
	public static void sieve()
	    {
	       int n=prime.length;
	        for(int i=0;i<n;i++)
	            prime[i] = true;

	        for(int p = 2; p*p <=n; p++)
	        {
	            if(prime[p] == true)
	            {
	                for(int i = p*2; i <n; i += p)
	                    prime[i] = false;
	            }
	        }
	    }

  public static String rev(String s)
	{
		StringBuilder sb=new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}
	static long lcm(long a, long b)
	{
	    return a * (b / gcd(a, b));
	}
	static long gcd(long a, long b)
	{
	    while (b > 0)
	    {
	        long temp = b;
	        b = a % b; // % is remainder
	        a = temp;
	    }
	    return a;
	}
	static InputReader in;
	static PrintWriter w;
static class InputReader
{

private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;

public InputReader(InputStream stream)
{
  this.stream = stream;
}

public int snext()
{
  if (snumChars == -1)
    throw new InputMismatchException();
  if (curChar >= snumChars)
  {
    curChar = 0;
    try
    {
      snumChars = stream.read(buf);
    }
    catch (IOException e)
    {
      throw new InputMismatchException();
    }
    if (snumChars <= 0)
      return -1;
  }
  return buf[curChar++];
}

public int nextInt()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  int sgn = 1;
  if (c == '-')
  {
    sgn = -1;
    c = snext();
  }
  int res = 0;
  do
  {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  }
  while (!isSpaceChar(c));
  return res * sgn;
}

public long nextLong()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  int sgn = 1;
  if (c == '-')
  {
    sgn = -1;
    c = snext();
  }
  long res = 0;
  do
  {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  }
  while (!isSpaceChar(c));
  return res * sgn;
}
public String readString()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  StringBuilder res = new StringBuilder();
  do
  {
    res.appendCodePoint(c);
    c = snext();
  }
  while (!isSpaceChar(c));
  return res.toString();
}

public String nextLine()
{
  int c = snext();
  while (isSpaceChar(c))
    c = snext();
  StringBuilder res = new StringBuilder();
  do
  {
    res.appendCodePoint(c);
    c = snext();
  }
  while (!isEndOfLine(c));
  return res.toString();
}

public boolean isSpaceChar(int c)
{
  if (filter != null)
    return filter.isSpaceChar(c);
  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}

private boolean isEndOfLine(int c)
{
  return c == '\n' || c == '\r' || c == -1;
}

public interface SpaceCharFilter
{
  public boolean isSpaceChar(int ch);
}
}

}

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long tab[]=new long[14];
		for(int i=0;i<14;i++) {
			tab[i]=sc.nextLong();
		}
		long res=0;
		long tabb[]=new long[14];
		for(int j=0;j<14;j++) {
			if(tab[j]!=0) {
				for(int i=0;i<14;i++) {
					tabb[i]=tab[i];
				}
				int imax=j;
				long stones=tabb[imax];
				tabb[imax]=0;
				for(int i=0;i<14;i++) {
					tabb[i]+=stones/14;
				}
				stones=stones%14;
				while(stones!=0) {
					if(imax<13) {
						imax++;
						tabb[imax]++;
					}
					else {
						imax=0;
						tabb[imax]++;
					}
					stones--;
				}
				res=Math.max(res,calcule(tabb));
			}
		}
		System.out.println(res);
	}
	public static long calcule(long tab[]) {
		long res=0;
		for(int i=0;i<14;i++) {
			if(tab[i]%2==0) res+=tab[i];
		}
		return res;
	}
}

import java.util.Scanner;

public class B_Mancala {

	public static long tr(long[] arr, int pos) {
		long cor = arr[pos] / 14;
		long d = arr[pos]%14;
		arr[pos] = 0;
		long sum = 0;
		int i = pos+1;
		while(d>0) {
			if (i==14) {
				i =0;
			}
			arr[i]++;
			d--;
			i++;
		}
		for(int g = 0;g<14;g++) {
			arr[g]+=cor;
			if( arr[g]%2==0) {
				sum+=arr[g];
			}
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long[] m = new long[14];
		for(int i=0;i<14;i++) {
			m[i] = scan.nextInt();
		}
		scan.close();
		long answ = 0;
		for (int i=0;i<14;i++) {
			if (m[i]==0) continue;
			answ = Math.max(tr(m.clone(),i ),answ);
		}
		System.out.print(answ);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int[] a = in.na(14);
            long ans = 0;
            for (int start = 0; start < 14; start++) {
                int[] b = Arrays.copyOf(a, 14);
                int num = a[start];
                b[start] = 0;
                for (int i = 0; i < 14; i++) {
                    b[i] += num / 14;
                }
                int rem = num % 14;
                for (int i = 1; i <= 14 && rem > 0; i++) {
                    int pos = (start + i) % 14;
                    b[pos]++;
                    rem--;
                }
                long sum = 0;
                for (int i = 0; i < 14; i++) {
                    if (b[i] % 2 == 0)
                        sum += b[i];
                }
                ans = Math.max(ans, sum);
            }
            out.println(ans);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

        public int[] na(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ni();
            return a;
        }

    }
}

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main{
    static long rep(int ix, long v[]){
	long c[] = new long[14];
	for(int i = 0; i<14;i++){
	    c[i] = v[i];
	}
	int a = ix+1;
	long te = c[ix];
	long rep = c[ix]/14;
	c[ix] = 0;
	for(int i = 0; i<14;i++){
	    c[i]+=rep;
	}
	rep = te%14;
	long may = 0;
	while(rep>0){
	    c[a%14]++;
	    a++;
	    rep--;
	}
	for(int i = 0; i<14;i++){
	    if(c[i]%2==0)may+=c[i];
	}
	return may;
    }

    public static void main(String[] args)throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
	String t[] = br.readLine().split(" ");
	long id = 0, x = 0, c = 0;
	long v[] = new long[14];
	for(int  i = 0;i<14;i++){
	    v[i] = Long.parseLong(t[i]);
	}
	long ans = 0;
	for(int i = 0; i<14;i++){
	    if(v[i]>0){
		ans = Math.max(ans,rep(i,v));
	    }
	}
	out.println(ans);
	out.close();
    }
}

import java.io.*;
public class Mancala
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input[] = br.readLine().split(" ");
        int a[] = new int[input.length];
        int b[] = new int[input.length];
        for(int i=0;i<input.length;i++)
        {
            a[i] = Integer.parseInt(input[i]);
            b[i] = a[i];
        }
        int n = input.length;
        long max = 0;
        int flag = 0;
        while(flag<n)
        {
            for(int i=0;i<n;i++)
                a[i] = b[i];
            if(a[flag] > 0)
                max = Math.max(max,answer(a,n,flag));
            flag++;
        }
        System.out.println(max);
    }
    static long answer(int a[],int n,int pos)
    {
        int val = a[pos]; // iterate over val
        int q = val/n;
        for(int i=0;i<n;i++)
            if(i == pos)
                a[i] = q;
            else
                a[i] += q;
        val %= n;
        // a[pos] = 0;
        if(pos + val + 1 <= n)
            for(int i = pos + 1;i<pos + val + 1;i++)
                a[i]++;
        else
        {
            for(int i = pos + 1;i<n;i++)
                a[i]++;
            for(int i=0;i<pos + val + 1 - n;i++)
                a[i]++;
        }
        /*for(int i=0;i<n;i++)
            System.out.print(a[i] + " ");
        System.out.println();*/
        long ct = 0;
        for(int i=0;i<n;i++)
            if(a[i] % 2 == 0)
                ct += 1L * a[i];
        return ct;
    }
}

import java.util.*;
import java.lang.*;

public class CF_20180501_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        // String in = "999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999 999999999";
        String[] input = in.split(" ");
        HashMap<Integer, Integer> orgMap = new HashMap<Integer, Integer>();
        long maxScore = 0;
        for (int i=0; i < input.length; i++) {
            orgMap.put(i, Integer.parseInt(input[i])); // pos, value pair
        }
        for (Map.Entry me : orgMap.entrySet()) {
            HashMap<Integer, Integer> tmpMap = new HashMap<Integer, Integer>(orgMap);
            Integer val = (Integer) me.getValue();
            if (val == 0) {
                continue;
            } else {
                Integer curPos = (Integer) me.getKey();
                tmpMap.put(curPos, (val/14));
// System.out.println("pos: " + curPos + ", curVal: " + tmpMap.get(curPos));
                long score = 0;
                for (int i=1; i < 14; i++) {
                    tmpMap.put((curPos+i)%14, tmpMap.get((curPos+i)%14)+((val/14) + (val % 14 >= i ? 1 : 0)));
// System.out.println("pos: " + (curPos+i)%14 + ", curVal: " + tmpMap.get((curPos+i)%14));
                }
                for (Map.Entry me2 : tmpMap.entrySet()) {
// System.out.print(me2.getValue() + " ");
                    score += (((Integer) me2.getValue() % 2 == 0) ? (Integer) me2.getValue() : 0);
                }
// System.out.println("");
                maxScore = maxScore > score ? maxScore : score;
// System.out.println("Score: " + score);
// System.out.println("Current max score: " + maxScore);
            }
        }
        System.out.println(maxScore);
        System.exit(0);
    }
}

import javax.swing.text.Segment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public  static void main(String[] args){
        Scanner reader = new Scanner(System.in);
        long[] a = new long[14];
        long[] tmp = new long[14];
        for(int i = 0; i < 14; i++)
            a[i] = reader.nextInt();
        long t, x, sum = 0;
        for (int i = 0; i < 14; i++){
            t = 0;
            for (int y = 0; y < 14; y++)
                tmp[y] = a[y];
            x = tmp[i];
            tmp[i] = 0;
            if (x >= 14){
                for (int j = 0; j < 14; j++){
                    tmp[j] += x / 14;
                }
            }
            x %= 14;
            int m = i + 1;
            while (x > 0){
                tmp[m%14] += 1;
                x--;
                m++;
            }

            for(int z = 0; z < 14; z++){
                if (tmp[z] % 2 == 0)
                    t += tmp[z];
            }

            if (t > sum)
                sum = t;
        }

        System.out.println(sum);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C{

	public static void main(String[] args)  throws Exception{
		Scanner sc = new Scanner (System.in);
		long [] a = new long [14];
		long max = 0;
		for(int i = 0 ; i< 14 ; i++)
			a[i] = sc.nextInt();

		for(int i = 0 ; i<14 ;i++)
		{
			long [] b = a.clone();
			long count = a[i];
			b[i] = 0;

			long every = count /14;
			long rem = count % 14;

			for(int j = 0 ; j<14 ;j++)
				b[j]+=every;

			for(int j = (i+1)%14 ; rem-->0 ;j= (j+1)%14)
				b[j]++;

			long res = 0 ;
			for(int j  =0 ; j<14 ;j++)
				if(b[j] % 2  == 0)
					res+=b[j];

			max = Math.max(res, max);

		}

		System.out.println(max);

	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.*;

public class JavaApplication1 {

    static int [] arr;
    public static void main(String[] args)   {

        Scanner in = new Scanner(System.in);

        arr = new int [14];
        for(int i=0; i<14;i++){
           arr[i] = in.nextInt();
        }

        ArrayList<Long> scores = new ArrayList<Long>();

        for(int i=0; i<14; i++){
            if(arr[i] != 0){
                scores.add(setAnd_getScores(i));
            }
        }

        System.out.println(Collections.max(scores));

    }

    public static long setAnd_getScores(int i){

        int [] ar = Arrays.copyOf(arr, 14);
        int stone = ar[i];
        ar[i] =0;
        i++;
        if(i == 14) i=0;

        if(stone < 14){
            for(int m = i; stone > 0; m++){
                if(m == 14) m=0;

                ar[m]++;
                stone--;
            }
        }
        else{
            int [] a = new int [14];

            int num = stone /14;
            int num2 = stone%14;
            Arrays.fill(a , num);

            for(int m = i; num2 > 0; m++){
                if(m == 14) m=0;

                a[m]++;
                num2--;
            }

            for(int o=0; o<14; o++){
                ar[o]+=a[o];
            }
        }

        long sum=0;
        for(int y=0; y<14; y++)
            if(ar[y] != 0 && ar[y] %2 == 0){
                sum+=ar[y];
            }

        return sum;
    }

}

import java.io.*;
import java.util.*;

public class Solution{

    public static void main(String[] args) throws Exception{
        long[] A = in.readLA();
        long max = 0;
        for(int i = 0; i < A.length; i++){
            long cur = 0, add = A[i]/14, nz = A[i]%14;
            // System.out.println(i+" "+add+" "+nz);
            // System.out.println(i+"-> ");
            int j = i+1;
            long[] B = new long[14];
            for(int c = 0; c < 14 ; c++){
                B[j%14] = ((j%14)!=i?A[j%14]:0) + add + ((nz-->0)?1:0);
                cur += B[j%14]%2==0?B[j%14]:0;
                // System.out.print(j%14+" ");
                j++;
            }
            if(cur > max)
               max = cur;
        }
        System.out.println(max);
    }

    static Inputer in;
    static {
        in = new Inputer();
    }

    static class Inputer{
        BufferedReader br;
        Inputer(){
            try{
                br = new BufferedReader(new InputStreamReader(System.in));
            }
            catch(Exception e){}
        }
        public int readInt() throws Exception{
            return Integer.parseInt(readLine());
        }
        public long readLong() throws Exception{
            return Long.parseLong(readLine());
        }
        public int[] readA(String delim) throws Exception{
            String[] s = readLine().split(delim);
            int[] A = new int[s.length];
            for(int i = 0; i < s.length; i++)
                A[i] = Integer.parseInt(s[i]);
            return A;
        }
        public int[] readA() throws Exception{
            String[] s = readLine().split("\\s+");
            int[] A = new int[s.length];
            for(int i = 0; i < s.length; i++)
                A[i] = Integer.parseInt(s[i]);
            return A;
        }
        public long[] readLA() throws Exception{
            String[] s = readLine().split("\\s+");
            long[] A = new long[s.length];
            for(int i = 0; i < s.length; i++)
                A[i] = Long.parseLong(s[i]);
            return A;
        }
        public String readLine() throws Exception{
            return br.readLine();
        }
        public int[] copyA(int[] A){
            int[] B = new int[A.length];
            for(int i= 0 ; i < A.length; i++)
                B[i] = A[i];
            return B;
        }
    }
    static void shuffle(int[] A){
        int n = A.length;
        Random rand = new Random();
        for(int t = 0; t < A.length; t++){
            int i1 = rand.nextInt(n);
            int i2 = rand.nextInt(n);
            int tmp = A[i1];
            A[i1] = A[i2];
            A[i2] = tmp;
        }
    }
}

import java.util.*;
public class Main {

	public static String sortString(String inputString)
    {
        // convert input string to char array
        char tempArray[] = inputString.toCharArray();

        // sort tempArray
        Arrays.sort(tempArray);

        // return new sorted string
        return new String(tempArray);
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		long[] arr1=new long[14];
		for(int i=0;i<14;i++) {
			arr1[i]=s.nextLong();
		}
		long ans1=0;
		for(int i=0;i<14;i++) {
			long[] arr=new long[14];
			for(int j=0;j<14;j++) {
				arr[j]=arr1[j];
			}
			long ans=0;
			long temp=arr[i];
arr[i]=0;
			long x=temp/14;
			for(int j=0;j<14;j++) {
				arr[j]=arr[j]+x;
			}
			long y=temp%14;
			int k=i+1;
			while(y!=0) {
				arr[(k)%14]++;
				k++;
				y--;
			}
			for(int j=0;j<14;j++) {
				if(arr[j]%2==0) {
					ans=ans+arr[j];
				}
			}
			if(ans>ans1) {
				ans1=ans;
			}

		}
		System.out.println(ans1);
	}

}

import java.io.BufferedReader;
import java.io.InputStream;
import java.lang.*;
import java.util.*;
public class fan_chipu {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		long ans = 0;
		long a[] = new long [456];
		for(int i = 0;i < 14;++i) {
			a[i] = input.nextLong();
		}
		for(int i = 0;i < 14;++i) {
			long x = a[i] % 14,res = 0;
			long c = a[i] / 14,y = a[i] % 14;
			long t = a[i];
			a[i] = 0;
			int j = i + 1;
			while(x-- > 0) {
				j %= 14;
				++a[j];
				++j;
			}
			for(int k = 0;k < 14;++k) {
				if((a[k] + c) % 2 == 0) res += a[k] + c;
			}
			j = i + 1;
			while(y-- > 0) {
				j %= 14;
				--a[j];
				++j;
			}
			a[i] = t;
			ans = Math.max(ans, res);
		}
		System.out.println(ans);
		input.close();
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = 14;
		long max = 0;
		long[] ar = new long[14];
		for(int i=0;i<n;i++){
			ar[i]=in.nextInt();
		}
		for(int i = 0; i<n;i++){
			long temp[] = new long[14];
			for(int j=0;j<n;j++){
				temp[j]=ar[j];
			}
			long m = ar[i];
			if(m>0){
				temp[i]=0;
				long a = m/14;
				long r = m%14;
				for(int j = 0;j<n;j++){
					temp[j]+=a;
				}

				int tempi = i;
				for(int j=0;j<r;j++){

					if(tempi==13){
						temp[0]+=1;
						tempi=0;
					}else{
						temp[tempi+1]+=1;
						tempi++;
					}
				}
				long tempm=0;

				for(int j=0;j<n;j++){
					if(temp[j]%2==0){
						tempm+=temp[j];
					}
				}

				if(max<tempm){

					max = tempm;}
			}

		}

		System.out.println(max);

	}

}

import java.io.*;
import java.util.*;

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        String s[]=bu.readLine().split(" ");
        int a[]=new int[14],i,j; long b[]=new long[14],max=0;
        for(i=0;i<14;i++)
        a[i]=Integer.parseInt(s[i]);

        for(i=0;i<14;i++)
        {
            for(j=0;j<14;j++)
            b[j]=a[j];
            long t=b[i]; b[i]=0;
            for(j=0;j<14;j++)
            b[j]+=t/14;
            t%=14; j=(i+1)%14;
            while(t!=0)
            {
                b[j]++;
                t--;
                j=(j+1)%14;
            }
            long res=0;
            for(j=0;j<14;j++)
            if(b[j]%2==0) res+=b[j];
            max=Math.max(max,res);
        }
        System.out.print(max);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class JavaApplication6 {

    public static void main(String[] args) throws IOException {
        in.init(System.in);
       StringBuilder sb=new StringBuilder();
       //
        StringTokenizer st=new StringTokenizer(in.nextLine());
        int n=st.countTokens();
          ArrayList<Long> a=new ArrayList<>();
        for (int i = 0; i <n; i++) {
            a.add(Long.parseLong(st.nextToken()));
        }
       long MaxSum=0;int Number=0;
       while(Number<14){
           ArrayList<Long> a2=new ArrayList<>(a);

           long Sum=0;
           long Stones=a2.get(Number);
           a2.set(Number,Stones-Stones);
           if(Stones!=0){
               long Mod=Stones%14;
               long sum=Stones/14;
               if(sum!=0){
               for (int i =Number+1; i <14; i++) {
                   if(Stones>0){
                   long y=a2.get(i);
                   if(Mod>0){
                     a2.set(i,y+sum+1);Mod--;}
                   else
                       a2.set(i,y+sum);
                   Stones--;}
               }
               for (int i = 0; i <=Number; i++) {
                   if(Stones>0){
                     long y=a2.get(i);
                   if(Mod>0){
                     a2.set(i,y+sum+1);Mod--;}
                   else
                       a2.set(i,y+sum);
                    Stones--;}
               }}
               else{
                    for (int i =Number+1; i <14; i++) {
                   if(Stones>0){
                   long y=a2.get(i);
                       a2.set(i,y+1);
                   Stones--;}
               }
                    for (int i = 0; i <Number; i++) {
                   if(Stones>0){
                     long y=a2.get(i);
                       a2.set(i,y+1);
                    Stones--;}
               }
               }

               for (int i = 0; i <14; i++) {
                   if(a2.get(i)%2==0)
                       Sum+=a2.get(i);
               }
               if(Sum>MaxSum)
                   MaxSum=Sum;
           }

           Number++;

       }
        System.out.println(MaxSum);

}

}

       class in {
        public static BufferedReader br;
        public static StringTokenizer st;

         static void init(InputStream input){
            br=new BufferedReader(new InputStreamReader(input));
            st=new StringTokenizer(" ");
        }

         static String nextLine() throws IOException{
             return br.readLine();
         }

         static String next() throws IOException{
             while(!st.hasMoreTokens()){
                 st=new StringTokenizer(br.readLine());

             }return st.nextToken();
         }

         static boolean hasNext(){
             return st.hasMoreTokens();
         }

         static int nextInt() throws IOException{
             return Integer.parseInt(next());
         }

          static double nextDouble() throws IOException{
             return Double.parseDouble(next());
         }

           static float nextfloat() throws IOException{
             return Float.parseFloat(next());
         }

           static long nextlong() throws IOException{
             return Long.parseLong(next());
         }
           static short nextShort() throws IOException{
             return Short.parseShort(next());
         }

    }

import java.util.Scanner;

/**
 *
 * @author paras
 */
public class stone {
   public static void main(String arg[] )
   {   long a[]=new long[14];
   Scanner ob=new Scanner(System.in);
   for(int i=0;i<14;i++)
      {
          a[i]=ob.nextLong();
      }
   int y=0;
   long min=-1;
   while(y!=14)
   {long ans=0;
       if(a[y]>0)
   {
       if(a[y]%14==0)
       {
           long pl=a[y]/14;
           long ses=a[y];
           a[y]=0;
           for(int i=0;i<14;i++)
           {

                   if((a[i]+pl)%2==0)
                   {
                       ans=ans+a[i]+pl;
                   }

           }
           a[y]=ses;
       }else
       {
        long pl=a[y]%14;
        long ses=a[y];

        if(pl==a[y])
        {int j=1;
         a[y]=0;
          while(pl!=0)
          {
              if((a[(y+j)%14]+1)%2==0)
              {
                  ans=ans+a[(y+j)%14]+1;
              }
              j++;
              pl--;
          }
            a[y]=ses;
        }
        else
        {
         long se=a[y]-pl;
         se/=14;
         int j=1;
         int yu=14;
         a[y]=0;
          while(yu!=0)
          {
              if(pl>=1)
             { if((a[(y+j)%14]+1+se)%2==0)
              {
                  ans=ans+a[(y+j)%14]+1+se;
              }

             }
              else
              {
                  if((a[(y+j)%14]+se)%2==0)
              {
                  ans=ans+a[(y+j)%14]+se;
              }
              }
              j++;
              yu--;
              pl--;

          }
          a[y]=ses;
        }

       }

   }
            min=Math.max(min,ans);

       y++;
   }
      System.out.println(min);

   }
}

import java.util.*;

/*
_Манкала
*/
public class B975 {
    public static void main(String...args){
        long answer = 0;
        Scanner sc = new Scanner(System.in);
        int[] lunki = new int[14];

        for(int i = 0; i < 14; i++){
            int a = sc.nextInt();
            lunki[i] = a;
        }

        for(int i = 0; i < 14; i++){
            int amount = lunki[i];
            if(amount != 0){
                long amountOfI = putting(lunki,i,amount);
                if(amountOfI > answer)
                    answer = amountOfI;
            }
        }
        System.out.println(answer);
    }
    public static long putting(int []arr,int index,int amount){
        int lunki[] = new int[14];

        //System.out.println("");
        System.arraycopy(arr, 0, lunki, 0, 14);

        lunki[index] = 0;

        //print(lunki);
        int amountToAll = amount / 14;
        int remainder = amount % 14;
        for(int i = 0; i < 14; i++){
            lunki[i] += amountToAll;
        }
        //print(lunki);
        for(int i = index+1; i < 14 && remainder>0; i++){
            lunki[i] += 1;remainder--;
        }
        for(int i = 0; i < index && remainder>0; i++){
            lunki[i] += 1;remainder--;
        }
        long answer = collectEven(lunki);
        //System.out.println("Answer-->" + answer);
        return answer;
    }

    public static long collectEven(int []lunki){
        long answer = 0;
        for(int i = 0; i < 14; i++)
            if(lunki[i]%2==0)
                answer+=lunki[i];
        return answer;
    }

    public static void print(int[]lunki){
        for(int i = 0; i < 14; i++){
            System.out.print(lunki[i]+" ");
        }
        System.out.println("");
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

/**
 * @author thesparkboy
 *
 */
public class A2 {

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n = 14;
		long ans = 0;
		long stones[] = new long[n];
		long temp[] = new long[n];
		for (int j = 0; j < n; j++) {
			stones[j] = in.readLong();
			temp[j] = stones[j];
		}
		for (int i = 0; i < n; i++) {
			if (stones[i] != 0) {
				long incr = stones[i] / 14;
				for (int j = 0; j < n; j++) {
					if (j != i)
						temp[j] += incr;
					else
						temp[j] = 0;
				}
				temp[i] += incr;
				long left = stones[i] % 14;
				int j = i + 1;
				while (left != 0) {
					if (j >= 14) {
						j = 0;
					}
					temp[j]++;
					j++;
					left--;
				}
				long sum = 0;
				for (int k = 0; k < n; k++) {
					if (temp[k] % 2 == 0) {
						sum += temp[k];
					}
				}
				ans = Math.max(ans, sum);
				for (int p = 0; p < n; p++) {
					temp[p] = stones[p];
				}
			}
		}
		System.out.println(ans);
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}
	}

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(outputStream);
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
    private static final PrintStream ps     = System.out;
    private static final InputStream IS     = System.in;
    private static final byte[]      BUFFER = new byte[1024];
    private static int               ptr    = 0;
    private static int               buflen = 0;

    public static void main(String[] args) {
        final int n = 14;
        long[] l = new long[n];
        long[][] a = new long[n][n];
        for (int i = 0; i < n; i++) {
            l[i] = nl();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (j == i)
                    a[i][j] = l[i] / n;
                else if (i < j)
                    a[i][j] = (l[j] + j - i) / 14;
                else
                    a[i][j] = (14 - (i-j) + l[j]) / 14;
            }
        }

        long max = 0;
        for (int j = 0; j < n; j++) {
            long tmpSum = 0;
            for (int i = 0; i < n; i++) {
                long after = 0;
                if (i == j) after = l[i] / n;
                else after = l[i] + a[i][j];
                if (after % 2 == 0)
                    tmpSum += after;
            }
            max = Math.max(max, tmpSum);
        }
        ps.println(max);
    }

    private static boolean hasNextByte() {
        if (ptr < buflen)
            return true;
        else {
            ptr = 0;
            try {
                buflen = IS.read(BUFFER);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0)
                return false;
        }
        return true;
    }

    private static int readByte() {
        if (hasNextByte())
            return BUFFER[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public static boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(BUFFER[ptr]))
            ptr++;
        return hasNextByte();
    }

    public static String n() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public static long nl() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b)
            throw new NumberFormatException();
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b))
                return minus ? -n : n;
            else
                throw new NumberFormatException();
            b = readByte();
        }
    }

    public static int ni() {
        long nl = nl();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public static double nextDouble() {
        return Double.parseDouble(n());
    }

    private static int[] nia(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = ni();
        return a;
    }
}

import java.util.*;

public class Solver {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n=14;
        long max = 0;
        long[] num=new long[14];
        for(int i=0;i<n;i++){
            num[i]=sc.nextInt();
        }

        long temp[]=new long[14];
        for (int i = 0; i < 14; ++i)
        {
            long sum = 0;
            for (int j = 0; j < 14; ++j)
            {
                temp[j] = num[j];
                if(i == j) temp[j] = 0;
            }
            long d = num[i]/14;
            long q = num[i]%14;

            for (int j = 0; j < q; ++j)
            {
                temp[(i+j+1)%14]++;
            }
            for (int j = 0; j < 14; ++j)
            {
                temp[j] += d;
                if(temp[j]%2 == 0){
                    sum += temp[j];
                }

            }

            max = max<sum?sum:max;
        }
        System.out.println(max);
    }

}

 import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.util.regex.*;
public class Myclass {

	public static void main(String[] args) {

		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		long a[]=new long[14];
		for(int i=0;i<14;i++)
			a[i]=in.nextLong();

		long max=Long.MIN_VALUE;

		for(int i=0;i<14;i++)
		{
			if(a[i]>0)
			{
			long[] b=new long [14];
			b=a.clone();

			long m=a[i]/14;
			long r=a[i]%14;
			for(int j=1;j<=14;j++)
			{
				if(r>0)
				{
					b[(i+j)%14]=b[(i+j)%14]+m+1;
					r--;
				}
				else
					b[(i+j)%14]=m+b[(i+j)%14];

			}
			b[i]=m;
			for(int j=0;j<14;j++)
				System.out.print(b[j]+" ");
			System.out.println();
			int sum=0;
			for(int j=0;j<14;j++)
			{
				if(b[j]%2==0)
				{
					sum+=b[j];
				}
			}
			if(sum>max)
				max=sum;
			}
		}
	pw.println(max);

		pw.flush();
		pw.close();
	}
		static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.util.Scanner;

public class B975 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] A = new int[14];
        for (int i=0; i<14; i++) {
            A[i] = in.nextInt();
        }
        int max = 0;
        for (int from=0; from<14; from++) {
            int a = A[from];
            int score = a/14;
            for (int i=1; i<14; i++) {
                int count = A[(from+i)%14] + (a+14-i)/14;
                if (count%2 == 0) {
                    score += count;
                }
            }
            max = Math.max(max, score);
        }
        System.out.println(max);
    }

}

import java.io.BufferedReader;
        import java.io.IOException;
        import java.io.InputStreamReader;
        import java.util.StringTokenizer;

public class compareStrings {

    public static void main(String[] args) {
        FastReader sc=new FastReader();
        int [] arr=new int[14];
        int [] scores=new int[14];
        int [] Fscores=new int[14];
        for (int i = 0; i <14 ; i++) {
            arr[i]=sc.nextInt();

        }

        for (int i = 0; i <14 ; i++) {
            for (int j = 0; j <14 ; j++) {
                 if(j==i){
                      scores[j]=arr[i]/14;
                      break;
                 }else
                     scores[j]=arr[i]/14+arr[j];

                if(j>i){
                    if(arr[i]%14>=j-i ){
                        scores[j]++;
                    }}else
                if(arr[i]%14>=13-i+j+1 ){
                    scores[j]++;
                }

            }
            int max=0;
            for (int j = 0; j < 14; j++) {
                if(scores[j]%2==0)
                    max+=scores[j];
            }
            Fscores[i]=max;

        }
        int max=0;
        for (int i = 0; i < 14; i++) {
            if(max<Fscores[i])
                max=Fscores[i];
        }
        System.out.println(max);

    }

}

class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        InputStreamReader inr = new InputStreamReader(System.in);
        br = new BufferedReader(inr);
    }

    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());
    }

}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class ProblemB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        List<Long> l = Arrays.stream(in.nextLine()
                .split(" "))
                .map(Long::valueOf).collect(Collectors.toList());

        Long max = Long.MIN_VALUE;
        for (int i = 0; i < l.size(); i++) {
            Long n = l.get(i);
            if (n.equals(0)) continue;

            List<Long> lcopy = new ArrayList<>(l);

            long add = n / 14;
            int j = i;
            lcopy.set(i, 0L);
            if (add != 0) {
                while (true) {
                    j = j + 1;
                    if (j == lcopy.size()) {
                        j = 0;
                    }
                    if (j == i) {
                        break;
                    }
                    lcopy.set(j, lcopy.get(j) + add);
                }
            }

            long i1 = n % 14;
            if (i1 != 0) {
                j = i;
                while (true) {
                    if (i1 == 0) {
                        break;
                    }
                    j = j + 1;
                    if (j == lcopy.size()) {
                        j = 0;
                    }
                    if (j == i && i1 != 0) {
                        break;
                    }
                    i1--;
                    lcopy.set(j, lcopy.get(j) + 1);
                }
            }

            max = Long.max(max, lcopy.stream().filter(v -> v % 2 == 0).mapToLong(v -> v).sum());
        }
        System.out.println(max);
    }
}

import java.util.*;
public class Main {

	public static String sortString(String inputString)
    {
        // convert input string to char array
        char tempArray[] = inputString.toCharArray();

        // sort tempArray
        Arrays.sort(tempArray);

        // return new sorted string
        return new String(tempArray);
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		long[] arr1=new long[14];
		for(int i=0;i<14;i++) {
			arr1[i]=s.nextLong();
		}
		long ans1=0;
		for(int i=0;i<14;i++) {
			long[] arr=new long[14];
			for(int j=0;j<14;j++) {
				arr[j]=arr1[j];
			}
			long ans=0;
			long temp=arr[i];
			long x=temp/14;
			for(int j=0;j<14;j++) {
				arr[j]=arr[j]+x;
			}
			long y=temp%14;
			int k=i+1;
			while(y!=0) {
				arr[(k)%14]++;
				k++;
				y--;
			}
			for(int j=0;j<14;j++) {
				if(arr[j]%2==0) {
					ans=ans+arr[j];
				}
			}
			if(ans>ans1) {
				ans1=ans;
			}

		}
		System.out.println(ans1);
	}

}

import java.io.*;
import java.util.*;

public class Codeforces
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        String s[]=bu.readLine().split(" ");
        int a[]=new int[14],i,j,b[]=new int[14],max=0;
        for(i=0;i<14;i++)
        a[i]=Integer.parseInt(s[i]);

        for(i=0;i<14;i++)
        {
            for(j=0;j<14;j++)
            b[j]=a[j];
            int t=b[i]; b[i]=0;
            for(j=0;j<14;j++)
            b[j]+=t/14;
            t%=14; j=(i+1)%14;
            while(t!=0)
            {
                b[j]++;
                t--;
                j=(j+1)%14;
            }
            int res=0;
            for(j=0;j<14;j++)
            if(b[j]%2==0) res+=b[j];
            max=Math.max(max,res);
        }
        System.out.print(max);
    }
}

import java.util.*;

/*
_Манкала
*/
public class B975 {
    public static void main(String...args){
        int answer = 0;
        Scanner sc = new Scanner(System.in);
        int[] lunki = new int[14];

        for(int i = 0; i < 14; i++){
            int a = sc.nextInt();
            lunki[i] = a;
        }

        for(int i = 0; i < 14; i++){
            int a = lunki[i];
            if(a!=0){
                int amountOfI = putting(lunki,i);
                if(amountOfI>answer)answer=amountOfI;
            }
        }
        System.out.println(answer);
    }
    public static int putting(int []arr,int a){
        int lunki[] = new int[14];
        System.arraycopy(arr, 0, lunki, 0, 14);
        int sizeOfA = lunki[a];
        lunki[a]=0;
        //System.out.println("sizeOfA->"+sizeOfA);
        if(sizeOfA>14){
            int amountToAll = sizeOfA/14;
            int other = sizeOfA%14;
            for(int i = 0; i < 14; i++)
                lunki[a]+=amountToAll;
            if(14-a<other){
                for(int i = a+1; i < 14; i++)
                    lunki[a]++;
                other-=(14-a-1);
                for(int i = 0; i < other; i++)
                    lunki[a]+=1;
            }
            else{
                for(int i = a+1; i < 14 && other!=0; i++){
                    lunki[i]++;
                    other--;
                }
            }
        }
        else{/*
            0 1 1 0 0 0 0 0 0 7 0 0 0 0

            */
            int other = sizeOfA;
            if(14-a<other){
                for(int i = a+1; i < 14; i++)
                    lunki[i]++;
                other-=(14-a-1);
                for(int i = 0; i < other; i++)
                    lunki[i]+=1;
            }
            else{

                for(int i = a+1; i < 14 && other!=0; i++){
                    lunki[i]++;
                    other--;
                //s    System.out.print(i+" ");print(lunki);
                }
            }
        }
        int amountOfI = collectEven(lunki);
        return amountOfI;
//        System.out.print(a+"  --->  ");print(lunki);
    }

    public static int collectEven(int []lunki){
        int answer = 0;
        for(int i = 0; i < 14; i++)
            if(lunki[i]%2==0)
                answer+=lunki[i];
        return answer;
    }
    public static void print(int[]lunki){
        for(int i = 0; i < 14; i++){
            System.out.print(lunki[i]+" ");
        }
        System.out.println("");
    }
}

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Scanner input = new Scanner (System.in);

	     ArrayList<Long> A  = new ArrayList<Long>();
	     for (int i = 0 ; i < 14 ; i ++)
	     {

	    	 A.add(input.nextLong());
	     }

	     long MaxEven = (long) 0 ;
	     long tempMax =(long) 0 ;
	     Long Current = (long) 0 ;
	     int Aindex = 0 ;
	     long roundsAdded = 0 ;
	     ArrayList<Long> B = new ArrayList<Long>(A.size());

	     boolean changed = true  ;
	     for (int i =0 ; i < 14 ; i++)
	     {

   		 if (changed)
   		 {B = new ArrayList<Long> ();
	    	 for (int j =0 ; j < 14 ; j++)
		     {
	    		 B.add(A.get(j));

		     }
   		 }
	    	 Current = B.get(i);
	    	 if (Current != 0 )
	    	 {
	    		 long rounds =  (long) Math.floor(Current/14);

	    		 long remainder =  (long)( Current%14);
	    	 B.set(i, (long) 0);
	    	 if(rounds>0)
	    	 {

	    		 roundsAdded = rounds ;

	    	 }

   		     Aindex = i+1 ;
   		     if (roundsAdded > 0)
   		     {
   		     for (int j =0 ; j < 14 ; j++)
   		     {
   	    		 B.set(j, B.get(j)+roundsAdded);
   	    		 long X = B.get(j);
   	    		 if (X%2==0)
   	    		 {
   	    			 tempMax = tempMax + X;

   	    		 }
   		     }}
   			 while (remainder>0 )
   			 {
   				 if(Aindex == 14 )
   		    		{
   		    			Aindex = 0;
   		    		}

   				 long M = B.get(Aindex)+1 ;
   				 remainder--;
   				 if (M%2 ==0)
   				 {
   					 tempMax= tempMax+M;

   				 }
   				 Aindex++ ;
   			 }

   			 if (tempMax>MaxEven)
   			 {

   				 MaxEven = tempMax ;
   			 }
   			 tempMax = 0 ;
   			changed = true ;
	    	 }
	    	 else {

	    		 changed = false ;
	    	 }
	     }

	     System.out.print(MaxEven);

	}
	}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class temp {

	public static int calc(int[] x, int extra) {
		int total = 0;
		for (int i = 0; i < 14; i++) {
			if ((x[i] + extra) % 2 == 0)
				total += x[i]+extra;
		}
		return total;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int[] mancala = new int[14];
		for (int i = 0; i < 14; i++) {
			mancala[i] = sc.nextInt();
		}
		int max = 0;
		for (int i = 0; i < 14; i++) {
			int[] x = new int[14];
			for (int k = 0; k < 14; k++) {
				x[k] = mancala[k];
			}
			int stones = mancala[i];
			x[i] = 0;
			int extra = stones / 14;
			stones -= (extra * 14);
			int j = i + 1;
			while (stones-- > 0) {
				if (j > 13)
					j = 0;
				x[j]++;
				j++;
			}
			max = Math.max(max, calc(x, extra));
		}
		out.println(max);
		out.flush();
		out.close();

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}

import java.io.BufferedReader;
import java.io.InputStream;
import java.lang.*;
import java.util.*;
public class fan_chipu {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int ans = 0;
		int a[] = new int [456];
		for(int i = 0;i < 14;++i) {
			a[i] = input.nextInt();
		}
		for(int i = 0;i < 14;++i) {
			int x = a[i] % 14,j = i + 1,res = 0;
			int c = a[i] / 14,y = a[i] % 14;
			while(x-- > 0) {
				j %= 14;
				++a[j];
				++j;
			}
			for(int k = 0;k < 14;++k) {
				if((a[k] + c) % 2 == 0) res += a[k] + c;
			}
			j = i + 1;
			while(y-- > 0) {
				j %= 14;
				--a[j];
				++j;
			}
			ans = Math.max(ans, res);
		}
		System.out.println(ans);
		input.close();
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

/**
 * @author thesparkboy
 *
 */
public class A2 {

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n = 14;
		long ans = 0;
		long stones[] = new long[n];
		long temp[] = new long[n];
		for (int j = 0; j < n; j++) {
			stones[j] = in.readLong();
			temp[j] = stones[j];
		}
		for (int i = 0; i < n; i++) {
			if (stones[i] != 0) {
				long incr = stones[i] / 14;
				for (int j = 0; j < n; j++) {
					if (j != i)
						temp[j] += incr;
					else
						temp[j] = 0;
				}
				long left = stones[i] % 14;
				int j = i + 1;
				while (left != 0) {
					if (j >= 14) {
						j = 0;
					}
					temp[j]++;
					j++;
					left--;
				}
				long sum = 0;
				for (int k = 0; k < n; k++) {
					if (temp[k] % 2 == 0) {
						sum += temp[k];
					}
				}
				ans = Math.max(ans, sum);
				for (int p = 0; p < n; p++) {
					temp[p] = stones[p];
				}
			}
		}
		System.out.println(ans);
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}
	}

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(outputStream);
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int tab[]=new int[14];
		for(int i=0;i<14;i++) {
			tab[i]=sc.nextInt();
		}
		int max=tab[0];
		int imax=0;
		for(int i=0;i<14;i++) {
			if(tab[i]>max) imax=i;
		}
		int stones=tab[imax];
		tab[imax]=0;
		while(stones!=0) {
			if(imax<13) {
				imax++;
				tab[imax]++;
			}
			else {
				imax=0;
				tab[imax]++;
			}
			stones--;
		}
		System.out.println(calcule(tab));
	}
	public static int calcule(int tab[]) {
		int res=0;
		for(int i=0;i<14;i++) {
			if(tab[i]%2==0) res+=tab[i];
		}
		return res;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C_975_B {

    private int getMaxForI(final int i, final int[] array) {
        int[] copy = Arrays.copyOf(array, array.length);

        int remain = copy[i];

        copy[i] = 0;

        int dist = remain / 14;

        for (int j = 1; j <= 14; j++) {
            copy[(i + j) % 14] += dist;
            remain -= dist;
        }

        int j = 1;
        while (remain > 0) {
            copy[(i + j) % 14]++;
            remain--;
            j++;
        }

        int sum = 0;
        for (int k = 0; k < copy.length; k++) {
            if (copy[k] % 2 == 0) sum += copy[k];
        }
        return sum;

    }

    private void solve() throws IOException {

        int[] array = nextArr(14);

        int max = 0;

        for (int i = 0; i < 14; i++) {
            if (array[i] > 0) {
                max = Math.max(getMaxForI(i, array), max);
            }
        }
        System.out.println(max);

        //        Set<Integer> set = new HashSet<>();
//
//        for (int i = 0; i < arr.length; i++) {
//            if (arr[i] == 0) continue;
//
//            int current = i;
//            int scores = arr[i];
//            int amount = 0;
//            int diff = scores / 14;
//            while (scores != 0) {
//                if (current == 13) current = 0;
//                else current++;
//                int curElem = arr[current];
//                int resEl = curElem + diff;
//                amount += resEl % 2 == 0 ? resEl : 0;
//                scores--;
//            }
//
//            set.add(amount);
//        }
//
//        List<Integer> list = new ArrayList<>(set);
//        Collections.sort(list);
//        System.out.println(list.get(list.size() - 1));
    }

    public static void main(String[] args) {
        new C_975_B().run();
    }

    StringTokenizer tokenizer;
    BufferedReader reader;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextInt();
        return arr;
    }

    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextLong();
        return arr;
    }

    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextDouble();
        return arr;
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
    private static final PrintStream ps     = System.out;
    private static final InputStream IS     = System.in;
    private static final byte[]      BUFFER = new byte[1024];
    private static int               ptr    = 0;
    private static int               buflen = 0;

    public static void main(String[] args) {
        final int n = 14;
        long[] l = new long[n];
        long max = 0;
        for (int i = 0; i < n; i++) {
            l[i] = nl();
        }

        for (int i = n-1; i >= 0; i--) {
            max = Math.max(max, f(l, i, n));
        }
        ps.println(max);
    }
    static long f(long[] l, int idx, int n) {
        int sum = 0;
        for (int i = 0; i < n; i++) {

            long after = l[i];
            if (i == idx)
                after += l[idx] / n;
            else if (i >= idx)
                after += (n - (i - idx) + l[idx]) / n;
            else
                after +=  (l[idx] + idx - i) / n;

            if (after % 2 == 0) {
                sum += after;
            }
        }
        return sum;
    }

    private static boolean hasNextByte() {
        if (ptr < buflen)
            return true;
        else {
            ptr = 0;
            try {
                buflen = IS.read(BUFFER);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0)
                return false;
        }
        return true;
    }

    private static int readByte() {
        if (hasNextByte())
            return BUFFER[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public static boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(BUFFER[ptr]))
            ptr++;
        return hasNextByte();
    }

    public static String n() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public static long nl() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b)
            throw new NumberFormatException();
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b))
                return minus ? -n : n;
            else
                throw new NumberFormatException();
            b = readByte();
        }
    }

    public static int ni() {
        long nl = nl();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public static double nextDouble() {
        return Double.parseDouble(n());
    }

    private static int[] nia(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = ni();
        return a;
    }
}

import java.util.Scanner;

public class Q2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int[] ar = new int[14];
		for (int i = 0; i < 14; i++) {
			ar[i]=scan.nextInt();
		}
		int maxscore=0;
		for(int i=0; i<14;i++){
			if(ar[i]!=0){
				int score = play(ar,i);
				maxscore=Math.max(maxscore, score);
			}
		}
		System.out.println(maxscore);
	}

	public static int play(int[] ar, int i){
		int temp[]= new int[14];
		for(int k=0;k<14;k++)
			temp[k]=ar[k];
		int score=0;
		int no=ar[i];
		temp[i]=0;
		for(int j=1; j<=no;j++){
			temp[(i+j)%14]=temp[(i+j)%14]+1;
			if(temp[(i+j)%14]%2==0){
				score+=temp[(i+j)%14];
			}

		}

		return score;

	}

}

 import java.io.*;
    import java.util.*;

        public class Codeforces {

    		   public static long log2(long x)
    			{
    				long p=1;
    				long ans=0;
    				while(x>=p)
    				{
    					p*=2;
    					ans++;
    				}
    				return ans-1;
    			}

    		   public static void extendedgcd(int a, int b)
    		   {
    			   x=0;
    			   y=0;
    			   gc=0;
    			   xgcd(a,b);
    			   pw.println(a+"*"+x+" + "+b+"*"+y+" = "+gc);

    		   }

    		   public static long modex(long a, long b, long c)
    		   {
    			   if(b==0)
    				   return 1;
    			   else if(b==1)
    				   return a%c;
    			   else if(b%2==0)
    			   {
    				   	return modex((a*a)%c,b/2,c);
    			   }
    			   else
    			   {
    				   return (a*modex((a*a)%c,b/2,c))%c;

    			   }

    		   }

    		   public static void xgcd(int a, int b)
    		   {

    			   if(b==0)
    			   {
    				   x=1;
    				   y=0;
    				   gc=a;

    			   }
    			   else
    			   {
    				   xgcd(b,a%b);
    				   int temp = x;
    				   x=y;
    				   y = temp - ((a/b)*y);

    			   }
    		   }

    		   public static long gcd(long a, long b)
    		   {
    			   if(b==0)return a;
    			   else return gcd(b,a%b);

    		   }

    		   static int x,y,gc;

    		   static HashSet<Character> set;

    		   public static long expmod(long a, long b, long mod)
    		   {
    			   if(b==0)return 1;
    			   if(b==1)return a;

    			   if(b%2==0)
    			   {
    				   return ((expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    			   else
    			   {
    				   return ((a%mod)*(expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    		   }

    		   static class Comp implements Comparator<Point>
    		   {

				@Override
				public int compare(Point arg0, Point arg1) {

					if(arg0.x>arg1.x)return 1;
					if(arg0.x<arg1.x)return -1;
					return 0;
				}

    		   }

    		   static class STComp implements Comparator<Integer>
    		   {

				@Override
				public int compare(Integer arg0, Integer arg1) {

					return arg0.compareTo(arg1);
				}

    		   }

    		   static class Point
    		   {
    			   int x,y,ind;

    			    public Point(int a, int b)
    			    {
    			    	x=a;
    			    	y=b;
    			    	ind=0;
    			    }

    		   }

    		   public static boolean issub(String s1, String s2)
    		   {
    			   if(s1.length()>s2.length())
    			   return false;

    			   int l1 = s1.length();
    			   int l2 = s2.length();

    			   for(int i=0;i<=l2-l1;i++)
    			   {
    				   String sub = s2.substring(i, i+l1);
    				   if(s1.equals(sub))return true;
    			   }

    			   return false;
    		   }

    		   public static String enc(String s, int n)
    		   {
    			   String s1 = s.substring(0,n);
    			   String s2 = s.substring(n, s.length());

    			  String re="";
    			  for(int i=s1.length()-1;i>=0;i--)re+=s1.charAt(i);

    			  return re+s2;

    		   }

    		   static int vis[];

    		   public static void dfs(int x)
    		   {
    			   vis[x]=1;

    			   ArrayList<Integer> li = adj[x];

    			   for(int ch:li)
    			   {

    				   if(vis[ch]==0)dfs(ch);

    			   }

    		   }
    		   /*
    		   public static void dfsm(int x, HashSet<Integer> set)
    		   {
    			   vis2[x]=1;

    			   ArrayList<Integer> li = adj[x];

    			   for(int ch:li)
    			   {
    				   //if(!set.contains(ch))continue;
    				   if(vis2[ch]==0)dfsm(ch,set);

    			   }

    		   }
    		   */

    		   public static void countPaths(int s, int d, ArrayList<Integer> pa)
    		   {

    			   vis2[s]=1;
    			   if(s==d)
    			   {
    				   pa.add(s);
    				 //  paths[ct] = new ArrayList<Integer>(pa);
    				   ct++;
    			   }
    			   else
    			   {
    				   ArrayList<Integer> li = adj[s];
    				   pa.add(s);

    				   for(int ad: li)
    				   {
    					   if(vis2[ad]==0)countPaths(ad,d,pa);
    				   }

    			   }

    			   if(pa.size()>1)pa.remove(pa.size()-1);
    			   vis2[s]=0;
    			   return ;
    		   }

    		   public static boolean dif(String s1, String s2)
    		   {
    			   int ct=0;
    			   if(s1.length()!=s2.length())return false;
    			   for(int i=0;i<s1.length();i++)
    			   {
    				   if(s1.charAt(i)!=s2.charAt(i))ct++;

    			   }

    			   if(ct==1)return true;
    			   else return false;

    		   }

    		   static void add(int arr[], int N, int lo,
                       int hi, int val)
    		   {
							    arr[lo] += val;
							    if (hi != N - 1)
							       arr[hi + 1] -= val;
    		   }

// Utility method to get actual array from
// operation array
static void updateArray(int arr[], int N)
{
    // convert array into prefix sum array
    for (int i = 1; i < N; i++)
        arr[i] += arr[i - 1];
}

// method to print final updated array
static void printArr(int arr[], int N)
{
    updateArray(arr, N);
    for (int i = 0; i < N; i++)
        System.out.print(""+arr[i]+" ");
    System.out.print("\n");
}

    		  static int cyc;

    		  public static void dfsmod(int v, HashSet<Integer> set)
    		  {
    			  vis2[v]=1;

    			  ArrayList<Integer> li = adj[v];

    			  set.add(v);

    			  for(int ch: li)
    			  {
    				  if(set.contains(ch))
    				  {
    					  cyc=1;
    					  pw.println("** "+ch+" "+v);
    				  }
    				  if(vis2[ch]==0)dfsmod(ch,set);

    			  }

    			  set.remove(v);

    		  }

    		  	public static boolean isps(int x)
    		  	{
    		  		int sq = (int)Math.sqrt(x);

    		  		return sq>0&&sq*sq==x;

    		  	}

    		  	 public static void combinations(String suffix,String prefix)
    		  	 {
    		         if(prefix.length()<0)return;
    		         pw.println(suffix);

    		         for(int i=0;i<prefix.length();i++)
    		          combinations(suffix+prefix.charAt(i),prefix.substring(i+1,prefix.length()));

    		     }

    		  	 public static void topo(int x)
    		  	 {
    		  		 vis2[x]=1;
    		  		// pw.println("vis "+x);
    		  		 ArrayList<Integer> li = adj[x];
    		  		// pw.println(x+" has siz "+li.size());
    		  		// Integer i = x;
    		  		 for(int ch: li)
    		  		 {

    		  			 if(vis2[ch]==0)
    		  				 {topo(ch);
    		  				//pw.println(x+" "+ch);
    		  				 }
    		  		 }

    		  		 st.push(x);
    		  		 //pw.println(i+" pushed");
    		  	 }

    		 	static  ArrayList<Integer>[] adj;
    		 	static int[] vis2;
    		 	static int ct;

    		     public static void ch(Stack<Integer> s)
    		     {
    		    	 s.push(4);
    		    	 return;
    		     }

    		     static Stack<Integer> st;

    		  	 public static void main(String[] args)
    	   {

    		  		int arr[] = new int[14];

    		  		for(int i=0;i<14;i++)arr[i]=sc.nextInt();

    		  		long ans = Integer.MIN_VALUE;
    		  		for(int i=0;i<14;i++)
    		  		{

    		  			int temp[] = new int[14];
    		  			for(int j=0;j<14;j++)temp[j]=arr[j];

    		  			int v = temp[i];
    		  			if(v==0)continue;

    		  			int q = v/14;
    		  			int r = v%14;

    		  			int st = (i+1)%14;
    		  			for(int ct=0;ct<14;ct++)
    		  			{
    		  				temp[st]+=q;
    		  				st = (st+1)%14;
    		  			}

    		  			for(int ct=0;ct<r;ct++)
    		  			{
    		  				temp[st]+=1;
    		  				st = (st+1)%14;
    		  			}

    		  			long score=0;

    		  			for(int j=0;j<14;j++)
    		  			{
    		  				if(temp[j]%2==0)score+=temp[j];
    		  			}

    		  			ans = Math.max(score, ans);

    		  		}

    		  		 pw.println(ans);

    		  		 /*
    		  		st = new Stack<Integer>();

    			  cyc=0;
       			adj = new ArrayList[4];
       			vis2 = new int[4];

       			Arrays.fill(vis2, 0);
       			for(int i=0;i<4;i++)adj[i] = new ArrayList<Integer>();

       			adj[0].add(1);
       			adj[0].add(2);
       			adj[0].add(3);

       			adj[1].add(3);

       			//adj[2].add(0);
       			adj[2].add(1);
    			   //adj[3].add(2);

       			st = new Stack<Integer>();

       			topo(0);

    			 while(!st.isEmpty())pw.println(st.pop());
    			 */

    			/*
    			int n = sc.nextInt();

    			int arr[] = new int[n];

    			for(int i=0;i<n;i++)arr[i]=sc.nextInt();

    			long ansg =0,ansv = Long.MAX_VALUE;

    			int arr2[] = new int[n];
    			for(int i=0;i<n;i++)arr2[i]=arr[i]-i;

    			for(int i=0;i<n;i++)
    			{
    				int x = arr2[i];

    				if(x<=0)
    				{

    					if(i<ansv)
    					{

    						ansg=i;
    						ansv=i;
    					}
    				}
    				else
    				{
    					float t = ((float)x)/n;
    					long tt = (long)Math.ceil(t);

    					long ex = i;
    					long ti = tt*n+ex;

    					if(ti<ansv)
    					{
    						//pw.println("** "+i);
    						ansg=i;
    						ansv=ti;
    					}

    				}

    			}

    			pw.println(ansg+1);
    			*/

    			   /*ct=0;

    			paths= new ArrayList[10];
    			adj = new ArrayList[4];
    			vis2 = new int[4];

    			for(int i=0;i<4;i++)adj[i] = new ArrayList<Integer>();

    			for(int i=0;i<10;i++)paths[i] = new ArrayList<Integer>();

    			adj[0].add(1);
    			adj[0].add(2);
    			adj[0].add(3);

    			adj[1].add(3);

    			adj[2].add(0);
    			adj[2].add(1);

    			countPaths(2,3, new ArrayList<Integer>());
    			pw.println(ct);

    			for(int i=0;i<ct;i++)pw.println(paths[i]);
    			  */

    			   /*
    			   int n = sc.nextInt();
    			int m = sc.nextInt();

    			int arr[] = new int[n];

    			for(int i=0;i<n;i++)arr[i]=sc.nextInt();

    			int req = n/m;

    			int[] rem = new int[m];

    			HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
    			for(int i=0;i<n;i++)
    			{
    				rem[arr[i]%m]++;

    			}
    			int li=-1;
    			long ans=0;
    			for(int i=0;i<m;i++)
    			{
    				if(rem[i]>=req)
    				{
    					rem[(i+1)%m]+=rem[i]-req;
    					ans+=(rem[i]-req);
    				}
    				else
    				{
    					li=i;

    				}
    			}

    			for(int i=0;i<li;i++)
    			{
    				if(rem[i]>=req)
    				{
    					rem[(i+1)%m]+=rem[i]-req;
    					ans+=(rem[i]-req);
    				}
    				else
    				{
    					li=i;

    				}
    			}
    			pw.println(ans);
    			*/

    			   //pw.println(pa);
    		/*	  NGE
       		int[] sto = {100,80,60,70,60,75,85};
       		int n = sto.length;

       		int[] spa = new int[n];
       		spa[0]=1;

       		Stack<Integer> st = new Stack<Integer>();
       		st.push(0);

       		for(int i=1;i<n;i++)
       		{

       			while(!st.isEmpty()&&sto[st.peek()]<=sto[i])st.pop();

       			spa[i]=(st.isEmpty())?i+1:i-st.peek();
       			st.push(i);

       		}

       		for(int i=0;i<n;i++)pw.print(sto[i]+" ");
    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(spa[i]+" ");

    			   int[] nge = new int[n];

    			   st.clear();
    			   Stack<Point> st2 = new Stack<Point>();
    			   st2.push(new Point(sto[0],0));

    			   for(int i=1;i<n;i++)
    			   {
    				   while(!st2.isEmpty()&&st2.peek().x<sto[i])
    				   {
    					   Point pop = st2.pop();
    					   nge[pop.y]=sto[i];
    				   }
    				   st2.push(new Point(sto[i],i));

    			   }

    			   while(!st2.isEmpty())
    			   {
    				   nge[st2.pop().y]=-1;
    			   }

    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(sto[i]+" ");
    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(nge[i]+" ");
    			 */

    			   /*  int r = 2000000000;
    			  pw.println(r);
    			int n = sc.nextInt();
    			int k = sc.nextInt();
    			int l = sc.nextInt();
    			int m = n*k;
    			int arr[] = new int[m];

    			for(int i=0;i<m;i++)arr[i]=sc.nextInt();

    			Arrays.sort(arr);

    			int limit = l+arr[0];
    			int li=-1;

    			for(int i=0;i<m;i++)
    			{
    				//pw.println(arr[i]);
    				if(arr[i]>limit)
    				{
    					//pw.println(arr[i]);
    					li=i; break;
    				}
    			}
    			//pw.println(limit+" "+li);
    			if(li==-1)li=n;

    			int noofsmallest = li;

    			if(noofsmallest<n)
    			{
    				pw.println(0);
    			}
    			else
    			{
    				li--;
    				long ans=0;
    				for(int i=0;i<n-1;i++)
    				{
    					ans+=(long)arr[li];
    					li--;
    				}
    				ans+=arr[0];
    				pw.println(ans);

    			}
    			  */

    			pw.close();

    	   }

    		   static  class MyScanner
    			{

    			BufferedReader br;
    			StringTokenizer st;

    			public MyScanner()
    			{
    				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;
    			}

    		}

    		static MyScanner sc = new  MyScanner();
    		static PrintWriter pw = new PrintWriter(System.out, true);

    		static class DisjointSet
    		{
    			int[] parent;
    			int[] rank;
    			int n;

    			public DisjointSet(int x)
    			{
    				n=x;
    				parent = new int[x];
    				rank = new int[x];

    				for(int i=0;i<n;i++)
    				{
    					parent[i]=i;
    				}

    			}

    			public int find(int x)
    			{

    				if(parent[x]==x)
    					return x;
    				else
    					return find(parent[x]);
    			}

    			public void union(int i, int j)
    			{
    				int iroot = find(i);
    				int jroot = find(j);

    				if(iroot==jroot)
    					return;

    				if(rank[iroot]<rank[jroot])
    				{
    					parent[iroot]=jroot;

    				}
    				else if(rank[jroot]<rank[iroot])
    				{
    					parent[jroot]=iroot;
    				}
    				else
    				{
    					parent[iroot]=jroot;
    					rank[jroot]++;

    				}

    			}

    		}

    	}

import java.util.*;
public class B {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long[] a = new long[14];
        for (int i = 0; i < 14; i++)  a[i] = in.nextLong();
        long max = 0;
        for (int i = 0; i < 14; i++) {
            if (a[i] == 0)  continue;
            long[] b = new long[14];

            long base = a[i] / 14;
            long remain = a[i] % 14;

            for (int j = 0; j < 14; j++) {
                if (i == j)  b[j] = base;
                else  b[j] = a[j]+base;
            }

            for (int k = 1; k <= remain; k++) {
                int id = (k+i)%14;
                b[id]++;
            }

            int cur = 0;
            for (int j = 0; j < 14; j++) {
                if (b[j] % 2 == 0)  cur += b[j];
            }
            max = Math.max(max, cur);
//            System.out.println(i +" "+cur+" "+base+" "+remain);
        }
        System.out.println(max);
    }
}

import java.util.*;
import static java.lang.Math.*;
import java.io.*;

public class SolutionB {

      public static void main(String args[])throws IOException{
              Scanner sc = new Scanner(System.in);
              int a[] = new int[14];
              for(int i = 0; i < 14; i++)
                     a[i] = sc.nextInt();
              int cpy[] = new int[14];
              int max = 0;
              for(int i = 0; i < 14; i++){
                     if(a[i] == 0)continue;
                     int score = 0;
                     int curr = a[i];
                     for(int j = 0; j < 14; j++)
                            cpy[j] = a[j];
                     cpy[i] = 0;
                     int amnt = curr / 14;
                     for(int j = 0; j < 14; j++){
                            cpy[j] += amnt;
                     }
                     amnt = curr % 14;
                     for(int j = i + 1; j < i + 1 + amnt; j++){
                            cpy[j % 14]++;
                     }
                     for(int j = 0; j < 14; j++){
                            if(cpy[j] % 2 == 0)
                                   score += cpy[j];
                     }
                     max = Math.max(max, score);
              }
              System.out.println(max);
      }
}

//Author: Patel Rag
//Java version "1.8.0_211"
import java.util.*;
import java.io.*;

public class Main
{
  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()); }

    float nextFloat() { return Float.parseFloat(next()); }

    boolean nextBoolean() { return Boolean.parseBoolean(next()); }

    String nextLine()
    {
      String str = "";
      try
      {
        str = br.readLine();
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      return str;
    }
  }
  static long modExp(long x, long n, long mod)    //binary Modular exponentiation
  {
    long result = 1;
    while(n > 0)
    {
        if(n % 2 == 1)
            result = (result%mod * x%mod)%mod;
        x = (x%mod * x%mod)%mod;
        n=n/2;
    }
    return result;
  }
  static long gcd(long a, long b)
  {
    if(a==0) return b;
    return gcd(b%a,a);
  }
  public static void main(String[] args)
  throws IOException
  {
    FastReader fr = new FastReader();
    long[] dat = new long[14];
    for(int i = 0; i < 14; i++) dat[i] = fr.nextLong();
    long res = 0;
    for(int i = 0; i < 14; i++)
    {
      long all = dat[i]/14;
      long last = dat[i]%14;
      long tot = 0;
      for(int j = 1; j < 14; j++)
      {
        int nex = (j + i)%14;
        long ava = dat[nex] + all;
        if(j <= last)
        {
           ava++;
          if(ava%2 == 0) tot = tot + ava;
        }
        else
        {
          if(ava%2 == 0) tot = tot + ava;
        }
      }
      res = Long.max(res,tot);
    }
    System.out.println(res);

  }
}
class pair
{
  public int first;
  public int second;
  public pair(int first,int second)
  {
    this.first = first;
    this.second = second;
  }
  public pair(pair p)
  {
    this.first = p.first;
    this.second = p.second;
  }
  public int first() { return first; }
  public int second() { return second; }
  public void setFirst(int first) { this.first = first; }
  public void setSecond(int second) { this.second = second; }
}
class myComp implements Comparator<pair>
{
  public int compare(pair a,pair b)
  {
    if(a.first != b.first) return (a.first - b.first);
    return (b.second - a.second);
  }
}

class BIT       //Binary Indexed Tree aka Fenwick Tree
{
  public long[] m_array;

  public BIT(long[] dat)
  {
    m_array = new long[dat.length + 1];
    Arrays.fill(m_array,0);
    for(int i = 0; i < dat.length; i++)
    {
      m_array[i + 1] = dat[i];
    }
    for(int i = 1; i < m_array.length; i++)
    {
      int j = i + (i & -i);
      if(j < m_array.length)
      {
        m_array[j] = m_array[j] + m_array[i];
      }
    }
  }

  public final long prefix_query(int i)
  {
    long result = 0;
    for(++i; i > 0; i = i - (i & -i))
    {
      result = result + m_array[i];
    }
    return result;
  }

  public final long range_query(int fro, int to)
  {
    if(fro == 0)
    {
      return prefix_query(to);
    }
    else
    {
      return (prefix_query(to) - prefix_query(fro - 1));
    }
  }

  public void update(int i, long add)
  {
    for(++i; i < m_array.length; i = i + (i & -i))
    {
      m_array[i] = m_array[i] + add;
    }
  }
}

import java.util.Scanner;

public class A_AramicScript {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int diff=0;
        int n = sc.nextInt();
        boolean[][] block = new boolean[n][30];
        String inp=sc.nextLine();
        for(int i=0 ; i<n ; i++){
            inp = sc.next();

            boolean[] temp = new boolean[30];
            for(int p = 0 ; p<inp.length() ; p++){
                int pos = inp.charAt(p)-'a';
                temp[pos]=true;
            }

            boolean bing = false;

            for(int x = 0 ; x<diff ; x++){
                if(isSame(temp,block[x])){
                    bing=true;
                    break;
                }
            }
            if(!bing){

                block[diff] = temp;
                diff++;
            }

        }
        System.out.println(diff);

    }

    static boolean isSame(boolean[] a, boolean[] b){
        for(int i=0 ; i<30 ; i++)
            if(a[i]!=b[i])
                return false;
        return true;
    }
}

import java.io.BufferedReader;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

import javax.print.attribute.standard.QueuedJobCount;

public class A {
	static int n;
	static TreeSet<Integer> Primes;
	static int[] arr;
	static int[] arr2;

	public static int[] copyOf(int[] arr) {
		for (int i = 0; i < arr.length; i++)
			arr2[i] += arr[i];
		return arr2;
	}

	public static int addEvens(int[] arr) {
		int r = 0;
		for (int i = 0; i < arr.length; i++)
			if (arr[i] % 2 == 0)
				r += arr[i];
		return r;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		arr = new int[14];
		for (int i = 0; i < 14; i++) {
			arr[i] = sc.nextInt();
		}
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < 14; i++) {
			int a = arr[i];
			arr2 = new int[14];
			arr2 = copyOf(arr);
			int j =0;
			int rem = arr[i] / 14;
			int steps = 0;
			int c = 0;
			for (  j = i+1;c<14; j++) {
				if (j >=14 )
					j = 0;
				arr2[c] += rem;
				c++;
			}
			steps = arr[i] % 14;
			j = i;
			c=0;
			for ( j = i+1;c<steps; j++) {
				if (j >= 14)
					j = 0;
				arr2[j] += rem + 1;
				c++;
			}
			max = Math.max(max, addEvens(arr2));
			//System.out.println(Arrays.toString(arr2));
		}
		pw.print(max);

		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class scratch_16{
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        long arr[]= new long[14];
        int max1=0;
        long max=0;
        for (int i = 0; i <14 ; i++) {
            arr[i]= sc.nextInt();
            if(arr[i]>max){
                max=arr[i];
                max1=i;
            }
        }
        //System.out.println("max="+max);
        //System.out.println("max1="+max1);
        leftRotate(arr,max1+1,14);
        //System.out.println(Arrays.toString(arr));
        arr[13]=0;
        long f= max/14;
        long g= max%14;
     //   System.out.println("f="+f);
      //  System.out.println("g="+g);
        for (int i = 0; i <14 ; i++) {
            arr[i]+=f;
        }
        for (int i = 0; i <g ; i++) {
            arr[i]+=1;
        }
        long ans=0;
        for (int i = 0; i <14 ; i++) {
            if(arr[i]%2==0 && arr[i]!=0){
                ans+=arr[i];
            }
        }
        //System.out.println(Arrays.toString(arr));
        System.out.println(ans);

    }
   static void leftRotate(long arr[], int d, int n)
    {
        for (int i = 0; i < d; i++)
            leftRotatebyOne(arr, n);
    }

    static void leftRotatebyOne(long arr[], int n)
    {
        int i;
        long temp;
        temp = arr[0];
        for (i = 0; i < n - 1; i++)
            arr[i] = arr[i + 1];
        arr[i] = temp;
    }
}

import java.util.*;

public class Main {
	public static void main(String[] main) {
		Scanner sc = new Scanner(System.in);
		int[] raw = new int[14];
		for (int i = 0; i < 14; i++) {
			raw[i] = sc.nextInt();
		}
		int max = Integer.MIN_VALUE;
		int[] nec = new int[14];
		for (int t = 0; t < 14; t++) {
			for (int i = 0; i < 14; i++)
				nec[i] = raw[i];
			if (raw[t] != 0) {
				int num = raw[t];
				nec[t] = 0;
				int cycle = num / 14;
				for (int i = 0; i < 14; i++)
					nec[i] += cycle;
				num = num % 14;
				int indx = t + 1, last = t + num;
				while (indx <= last) {
					nec[indx % 14] += 1;
					indx++;
				}
			}
			int cnt = 0;
			for (int i = 0; i < 14; i++) {
				if (nec[i] % 2 == 0) {
					cnt += nec[i];
				}
			}
			if (cnt > max)
				max = cnt;
		}
		System.out.println(max);
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class Mancala {
public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int array[]=new int[14];

	int big=0,index=0;
	for(int i=0;i<14;i++){
		array[i]=sc.nextInt();
		if(array[i]>big){big=array[i];index=i;}
	}
	array[index]=0;
	int p=big/14;
	if(p>0){
	for(int i=0;i<array.length;i++){
		array[i]=array[i]+p;
	}}
	int rem=big-(14*p);
	if(rem>(array.length-index-1)){
		for(int i=index+1;i<array.length;i++){
			if(rem==0){break;}

			array[i]=array[i]+1;rem=rem-1;
		}
		for(int i=0;i<array.length;i++){
			if(rem==0){break;}

			array[i]=array[i]+1;rem=rem-1;
		}
	}else{
		for(int i=index+1;i<array.length;i++){
			if(rem==0){break;}
			array[i]=array[i]+1;rem=rem-1;
		}
	}
	long sum=0;
	for(int i=0;i<array.length;i++){
		if(array[i]%2==0){
			sum=sum+array[i];

		}
	}
	System.out.println(sum);
}
}

/*input
0 28 1 0 0 0 0 0 0 7 0 0 0 0

*/
import java.io.*;
import java.util.*;
public class Main
{
    static int find(int ans[],int in)
{
    int[] arr=new int[14];
    for(int i=0;i<14;i++)
        arr[i]=ans[i];
    int x=arr[in]/14;
    // System.out.println(x);
    for(int i=0;i<14;i++)
         arr[i]+=x;
    // for(int i=0;i<14;i++)
        // System.out.print(arr[i]+" ");
    // System.out.println();
    for(int c=0;c<arr[in]%14;c++)
    {
        arr[(c+in+1)%14]++;
    }

    int sum=0;
    for(int i=0;i<14;i++)
    {
        if(arr[i]%2==0)
        {
            sum+=arr[i];
        }
    }
    return sum;
}
    public static void main(String[] args) throws Exception
    {
        Bolt sc=new Bolt(System.in);
        // int n=sc.nextInt();
        int[] arr=new int[14];
    for(int i=0;i<14;i++)
    {
        arr[i]=sc.nextInt();
    }
    int max=0;
    for(int i=0;i<14;i++)
    {
        if(arr[i]%2==0)
        {
            max+=arr[i];
        }
    }
    // cout<<max;
    for(int i=0;i<14;i++)
    {
        if(arr[i]==0)
            continue;
        int x=find(arr,i);
        // System.out.print(arr[i]+" ");
        if(x>max)
            max=x;
    }
    System.out.println(max);
    }
}
class Bolt{

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        Bolt(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }

        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }

import java.io.BufferedReader;
import java.io.InputStream;
import java.lang.*;
import java.util.*;
public class fan_chipu {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int ans = 0;
		int a[] = new int [456];
		for(int i = 0;i < 14;++i) {
			a[i] = input.nextInt();
		}
		for(int i = 0;i < 14;++i) {
			if(a[i] > 28) {
				ans = 0;
				for(int j = 0;j < 14;++j) {
					ans += a[j];
				}
				System.out.println(ans);
				return;
			}
			int x = a[i],j = i + 1,res = 0;
			boolean check[] = new boolean [15];
			while(x-- > 0) {
				j %= 14;
				++a[j % 14];
				if(a[j] > 1 && check[j] == false) {
					res += a[j];
					check[j] = true;
				}
				else if(check[j] == true) res++;
				++j;
			}
			x = a[i];
			j = i + 1;
			while(x-- > 0) {
				j %= 14;
				--a[j % 14];
				++j;
			}
			ans = Math.max(ans, res);
		}
		System.out.println(ans);
		input.close();
	}
}

/*input
0 0 1 0 0 0 0 0 0 7 0 0 0 14

*/
import java.io.*;
import java.util.*;
public class Main
{
    static int find(int ans[],int in)
{
    int[] arr=new int[14];
    for(int i=0;i<14;i++)
        arr[i]=ans[i];
    int x=arr[in]/14;
    int y=arr[in]%14;
    // System.out.println(y);
    arr[in]=0;
    // System.out.println(x);
    for(int i=0;i<14;i++)
         arr[i]+=x;

    for(int c=0;c<y;c++)
    {
        arr[(c+in+1)%14]++;
    }
    // for(int i=0;i<14;i++)
    //     System.out.print(arr[i]+" ");
    // System.out.println();

    int sum=0;
    for(int i=0;i<14;i++)
    {
        if(arr[i]%2==0)
        {
            sum+=arr[i];
        }
    }
    return sum;
}
    public static void main(String[] args) throws Exception
    {
        Bolt sc=new Bolt(System.in);
        // int n=sc.nextInt();
        int[] arr=new int[14];
    for(int i=0;i<14;i++)
    {
        arr[i]=sc.nextInt();
    }
    int max=0;
    // for(int i=0;i<14;i++)
    // {
    //     if(arr[i]%2==0)
    //     {
    //         max+=arr[i];
    //     }
    // }
    // cout<<max;
    for(int i=0;i<14;i++)
    {
        if(arr[i]==0)
            continue;
        int x=find(arr,i);
        // System.out.print(arr[i]+" ");
        if(x>max)
            max=x;
    }
    System.out.println(max);
    }
}
class Bolt{

        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;

        Bolt(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }

        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }

        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }

        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;

public class Solution {

    public static long[] toLongArrFromStringArr(String[] arr) {
        return Arrays.stream(arr).mapToLong(new ToLongFunction<String>() {
            @Override
            public long applyAsLong(String value) {
                return Long.parseLong(value);
            }
        }).toArray();
    }

    public static long solve(final long [] arr, final int MAX) {
        long result = 0;
        for (int i = 0; i < MAX; i++) {
            long[] tempArr = new long[MAX];
            System.arraycopy(arr, 0, tempArr, 0, MAX);
            long remaining = arr[i] % MAX;
            long extraCount = arr[i] / MAX;
            tempArr[i] = 0;
            int j = i + 1;
            while (remaining > 0) {
                j %= MAX;
                tempArr[j]++;
                j++;
                remaining--;
            }
            if (extraCount > 0) {
                for (int k = 0; k < MAX; k++) {
                    tempArr[k] += extraCount;
                }
            }
            int evenSum = 0;
            for (long k : tempArr) {
                if(k % 2 == 0) {
                    evenSum += k;
                }
            }
            result = Math.max(result, evenSum);
        }
        return result;
    }

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println(solve(toLongArrFromStringArr(br.readLine().split(" ")), 14));
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

/**
 * @author thesparkboy
 *
 */
public class A2 {

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n = 14;
		long ans = 0;
		long stones[] = new long[n];
		long temp[] = new long[n];
		for (int j = 0; j < n; j++) {
			stones[j] = in.readLong();
			temp[j] = stones[j];
		}
		for (int i = 0; i < n; i++) {
			if (stones[i] != 0) {
				long incr = stones[i] / 14;
				for (int j = 0; j < n; j++) {
					if (j != i)
						temp[j] += incr;
					else
						temp[j] = 0;
				}
				long left = stones[i] % 14;
				int j = i + 1;
				while (left != 0) {
					if (j >= 14) {
						j = 0;
					}
					if (j == i) {
						j++;
						continue;
					}
					temp[j]++;
					j++;
					left--;
				}
				long sum = 0;
				for (int k = 0; k < n; k++) {
					if (temp[k] % 2 == 0) {
						sum += temp[k];
					}
				}
				ans = Math.max(ans, sum);
				for (int p = 0; p < n; p++) {
					temp[p] = stones[p];
				}
			}
		}
		System.out.println(ans);
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}
	}

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(outputStream);
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mostafa
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        final int N = 14;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[] a = new int[N];
            for (int i = 0; i < N; i++) {
                a[i] = in.nextInt();
            }

            int max = 0;
            for (int i = 0; i < N; i++) {
                if (a[i] > 0) {

                    int[] b = new int[N];
                    for (int j = 0; j < N; j++) {
                        b[j] = a[j];
                    }

                    b[i] = 0;
                    int periods = a[i] / 14;
                    int steps = a[i] % 14;
                    for (int j = 0; j < N; j++) {
                        b[j] += periods;
                    }

                    int start = i + 1;
                    for (int j = 0; j < steps; j++) {
                        if (start == N)
                            start = 0;
                        b[start++]++;
                    }

                    int sum = 0;
                    for (int j = 0; j < N; j++) {
                        if (b[j] % 2 == 0)
                            sum += b[j];
                    }
                    max = Integer.max(max, sum);
                }
            }
            out.print(max);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

 import java.io.*;
    import java.util.*;

        public class Codeforces {

    		   public static long log2(long x)
    			{
    				long p=1;
    				long ans=0;
    				while(x>=p)
    				{
    					p*=2;
    					ans++;
    				}
    				return ans-1;
    			}

    		   public static void extendedgcd(int a, int b)
    		   {
    			   x=0;
    			   y=0;
    			   gc=0;
    			   xgcd(a,b);
    			   pw.println(a+"*"+x+" + "+b+"*"+y+" = "+gc);

    		   }

    		   public static long modex(long a, long b, long c)
    		   {
    			   if(b==0)
    				   return 1;
    			   else if(b==1)
    				   return a%c;
    			   else if(b%2==0)
    			   {
    				   	return modex((a*a)%c,b/2,c);
    			   }
    			   else
    			   {
    				   return (a*modex((a*a)%c,b/2,c))%c;

    			   }

    		   }

    		   public static void xgcd(int a, int b)
    		   {

    			   if(b==0)
    			   {
    				   x=1;
    				   y=0;
    				   gc=a;

    			   }
    			   else
    			   {
    				   xgcd(b,a%b);
    				   int temp = x;
    				   x=y;
    				   y = temp - ((a/b)*y);

    			   }
    		   }

    		   public static long gcd(long a, long b)
    		   {
    			   if(b==0)return a;
    			   else return gcd(b,a%b);

    		   }

    		   static int x,y,gc;

    		   static HashSet<Character> set;

    		   public static long expmod(long a, long b, long mod)
    		   {
    			   if(b==0)return 1;
    			   if(b==1)return a;

    			   if(b%2==0)
    			   {
    				   return ((expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    			   else
    			   {
    				   return ((a%mod)*(expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    		   }

    		   static class Comp implements Comparator<Point>
    		   {

				@Override
				public int compare(Point arg0, Point arg1) {

					if(arg0.x>arg1.x)return 1;
					if(arg0.x<arg1.x)return -1;
					return 0;
				}

    		   }

    		   static class STComp implements Comparator<Integer>
    		   {

				@Override
				public int compare(Integer arg0, Integer arg1) {

					return arg0.compareTo(arg1);
				}

    		   }

    		   static class Point
    		   {
    			   int x,y,ind;

    			    public Point(int a, int b)
    			    {
    			    	x=a;
    			    	y=b;
    			    	ind=0;
    			    }

    		   }

    		   public static boolean issub(String s1, String s2)
    		   {
    			   if(s1.length()>s2.length())
    			   return false;

    			   int l1 = s1.length();
    			   int l2 = s2.length();

    			   for(int i=0;i<=l2-l1;i++)
    			   {
    				   String sub = s2.substring(i, i+l1);
    				   if(s1.equals(sub))return true;
    			   }

    			   return false;
    		   }

    		   public static String enc(String s, int n)
    		   {
    			   String s1 = s.substring(0,n);
    			   String s2 = s.substring(n, s.length());

    			  String re="";
    			  for(int i=s1.length()-1;i>=0;i--)re+=s1.charAt(i);

    			  return re+s2;

    		   }

    		   static int vis[];

    		   public static void dfs(int x)
    		   {
    			   vis[x]=1;

    			   ArrayList<Integer> li = adj[x];

    			   for(int ch:li)
    			   {

    				   if(vis[ch]==0)dfs(ch);

    			   }

    		   }
    		   /*
    		   public static void dfsm(int x, HashSet<Integer> set)
    		   {
    			   vis2[x]=1;

    			   ArrayList<Integer> li = adj[x];

    			   for(int ch:li)
    			   {
    				   //if(!set.contains(ch))continue;
    				   if(vis2[ch]==0)dfsm(ch,set);

    			   }

    		   }
    		   */

    		   public static void countPaths(int s, int d, ArrayList<Integer> pa)
    		   {

    			   vis2[s]=1;
    			   if(s==d)
    			   {
    				   pa.add(s);
    				 //  paths[ct] = new ArrayList<Integer>(pa);
    				   ct++;
    			   }
    			   else
    			   {
    				   ArrayList<Integer> li = adj[s];
    				   pa.add(s);

    				   for(int ad: li)
    				   {
    					   if(vis2[ad]==0)countPaths(ad,d,pa);
    				   }

    			   }

    			   if(pa.size()>1)pa.remove(pa.size()-1);
    			   vis2[s]=0;
    			   return ;
    		   }

    		   public static boolean dif(String s1, String s2)
    		   {
    			   int ct=0;
    			   if(s1.length()!=s2.length())return false;
    			   for(int i=0;i<s1.length();i++)
    			   {
    				   if(s1.charAt(i)!=s2.charAt(i))ct++;

    			   }

    			   if(ct==1)return true;
    			   else return false;

    		   }

    		   static void add(int arr[], int N, int lo,
                       int hi, int val)
    		   {
							    arr[lo] += val;
							    if (hi != N - 1)
							       arr[hi + 1] -= val;
    		   }

// Utility method to get actual array from
// operation array
static void updateArray(int arr[], int N)
{
    // convert array into prefix sum array
    for (int i = 1; i < N; i++)
        arr[i] += arr[i - 1];
}

// method to print final updated array
static void printArr(int arr[], int N)
{
    updateArray(arr, N);
    for (int i = 0; i < N; i++)
        System.out.print(""+arr[i]+" ");
    System.out.print("\n");
}

    		  static int cyc;

    		  public static void dfsmod(int v, HashSet<Integer> set)
    		  {
    			  vis2[v]=1;

    			  ArrayList<Integer> li = adj[v];

    			  set.add(v);

    			  for(int ch: li)
    			  {
    				  if(set.contains(ch))
    				  {
    					  cyc=1;
    					  pw.println("** "+ch+" "+v);
    				  }
    				  if(vis2[ch]==0)dfsmod(ch,set);

    			  }

    			  set.remove(v);

    		  }

    		  	public static boolean isps(int x)
    		  	{
    		  		int sq = (int)Math.sqrt(x);

    		  		return sq>0&&sq*sq==x;

    		  	}

    		  	 public static void combinations(String suffix,String prefix)
    		  	 {
    		         if(prefix.length()<0)return;
    		         pw.println(suffix);

    		         for(int i=0;i<prefix.length();i++)
    		          combinations(suffix+prefix.charAt(i),prefix.substring(i+1,prefix.length()));

    		     }

    		  	 public static void topo(int x)
    		  	 {
    		  		 vis2[x]=1;
    		  		// pw.println("vis "+x);
    		  		 ArrayList<Integer> li = adj[x];
    		  		// pw.println(x+" has siz "+li.size());
    		  		// Integer i = x;
    		  		 for(int ch: li)
    		  		 {

    		  			 if(vis2[ch]==0)
    		  				 {topo(ch);
    		  				//pw.println(x+" "+ch);
    		  				 }
    		  		 }

    		  		 st.push(x);
    		  		 //pw.println(i+" pushed");
    		  	 }

    		 	static  ArrayList<Integer>[] adj;
    		 	static int[] vis2;
    		 	static int ct;

    		     public static void ch(Stack<Integer> s)
    		     {
    		    	 s.push(4);
    		    	 return;
    		     }

    		     static Stack<Integer> st;

    		  	 public static void main(String[] args)
    	   {

    		  		int arr[] = new int[14];

    		  		for(int i=0;i<14;i++)arr[i]=sc.nextInt();

    		  		long ans = Integer.MIN_VALUE;
    		  		for(int i=0;i<14;i++)
    		  		{

    		  			int temp[] = new int[14];
    		  			for(int j=0;j<14;j++)temp[j]=arr[j];

    		  			int v = temp[i];
    		  			if(v==0)continue;

    		  			int q = v/14;
    		  			int r = v - (q*14);

    		  			int st = (i+1)%14;
    		  			for(int ct=0;ct<14;ct++)
    		  			{
    		  				temp[st]+=q;
    		  				st = (st+1)%14;
    		  			}

    		  			for(int ct=0;ct<r;ct++)
    		  			{
    		  				temp[st]+=1;
    		  				st = (st+1)%14;
    		  			}

    		  			long score=0;

    		  			for(int j=0;j<14;j++)
    		  			{
    		  				if(temp[j]%2==0)score+=temp[j];
    		  			}

    		  			ans = Math.max(score, ans);

    		  		}

    		  		 pw.println(ans);

    		  		 /*
    		  		st = new Stack<Integer>();

    			  cyc=0;
       			adj = new ArrayList[4];
       			vis2 = new int[4];

       			Arrays.fill(vis2, 0);
       			for(int i=0;i<4;i++)adj[i] = new ArrayList<Integer>();

       			adj[0].add(1);
       			adj[0].add(2);
       			adj[0].add(3);

       			adj[1].add(3);

       			//adj[2].add(0);
       			adj[2].add(1);
    			   //adj[3].add(2);

       			st = new Stack<Integer>();

       			topo(0);

    			 while(!st.isEmpty())pw.println(st.pop());
    			 */

    			/*
    			int n = sc.nextInt();

    			int arr[] = new int[n];

    			for(int i=0;i<n;i++)arr[i]=sc.nextInt();

    			long ansg =0,ansv = Long.MAX_VALUE;

    			int arr2[] = new int[n];
    			for(int i=0;i<n;i++)arr2[i]=arr[i]-i;

    			for(int i=0;i<n;i++)
    			{
    				int x = arr2[i];

    				if(x<=0)
    				{

    					if(i<ansv)
    					{

    						ansg=i;
    						ansv=i;
    					}
    				}
    				else
    				{
    					float t = ((float)x)/n;
    					long tt = (long)Math.ceil(t);

    					long ex = i;
    					long ti = tt*n+ex;

    					if(ti<ansv)
    					{
    						//pw.println("** "+i);
    						ansg=i;
    						ansv=ti;
    					}

    				}

    			}

    			pw.println(ansg+1);
    			*/

    			   /*ct=0;

    			paths= new ArrayList[10];
    			adj = new ArrayList[4];
    			vis2 = new int[4];

    			for(int i=0;i<4;i++)adj[i] = new ArrayList<Integer>();

    			for(int i=0;i<10;i++)paths[i] = new ArrayList<Integer>();

    			adj[0].add(1);
    			adj[0].add(2);
    			adj[0].add(3);

    			adj[1].add(3);

    			adj[2].add(0);
    			adj[2].add(1);

    			countPaths(2,3, new ArrayList<Integer>());
    			pw.println(ct);

    			for(int i=0;i<ct;i++)pw.println(paths[i]);
    			  */

    			   /*
    			   int n = sc.nextInt();
    			int m = sc.nextInt();

    			int arr[] = new int[n];

    			for(int i=0;i<n;i++)arr[i]=sc.nextInt();

    			int req = n/m;

    			int[] rem = new int[m];

    			HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
    			for(int i=0;i<n;i++)
    			{
    				rem[arr[i]%m]++;

    			}
    			int li=-1;
    			long ans=0;
    			for(int i=0;i<m;i++)
    			{
    				if(rem[i]>=req)
    				{
    					rem[(i+1)%m]+=rem[i]-req;
    					ans+=(rem[i]-req);
    				}
    				else
    				{
    					li=i;

    				}
    			}

    			for(int i=0;i<li;i++)
    			{
    				if(rem[i]>=req)
    				{
    					rem[(i+1)%m]+=rem[i]-req;
    					ans+=(rem[i]-req);
    				}
    				else
    				{
    					li=i;

    				}
    			}
    			pw.println(ans);
    			*/

    			   //pw.println(pa);
    		/*	  NGE
       		int[] sto = {100,80,60,70,60,75,85};
       		int n = sto.length;

       		int[] spa = new int[n];
       		spa[0]=1;

       		Stack<Integer> st = new Stack<Integer>();
       		st.push(0);

       		for(int i=1;i<n;i++)
       		{

       			while(!st.isEmpty()&&sto[st.peek()]<=sto[i])st.pop();

       			spa[i]=(st.isEmpty())?i+1:i-st.peek();
       			st.push(i);

       		}

       		for(int i=0;i<n;i++)pw.print(sto[i]+" ");
    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(spa[i]+" ");

    			   int[] nge = new int[n];

    			   st.clear();
    			   Stack<Point> st2 = new Stack<Point>();
    			   st2.push(new Point(sto[0],0));

    			   for(int i=1;i<n;i++)
    			   {
    				   while(!st2.isEmpty()&&st2.peek().x<sto[i])
    				   {
    					   Point pop = st2.pop();
    					   nge[pop.y]=sto[i];
    				   }
    				   st2.push(new Point(sto[i],i));

    			   }

    			   while(!st2.isEmpty())
    			   {
    				   nge[st2.pop().y]=-1;
    			   }

    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(sto[i]+" ");
    			   pw.println();
    			   for(int i=0;i<n;i++)pw.print(nge[i]+" ");
    			 */

    			   /*  int r = 2000000000;
    			  pw.println(r);
    			int n = sc.nextInt();
    			int k = sc.nextInt();
    			int l = sc.nextInt();
    			int m = n*k;
    			int arr[] = new int[m];

    			for(int i=0;i<m;i++)arr[i]=sc.nextInt();

    			Arrays.sort(arr);

    			int limit = l+arr[0];
    			int li=-1;

    			for(int i=0;i<m;i++)
    			{
    				//pw.println(arr[i]);
    				if(arr[i]>limit)
    				{
    					//pw.println(arr[i]);
    					li=i; break;
    				}
    			}
    			//pw.println(limit+" "+li);
    			if(li==-1)li=n;

    			int noofsmallest = li;

    			if(noofsmallest<n)
    			{
    				pw.println(0);
    			}
    			else
    			{
    				li--;
    				long ans=0;
    				for(int i=0;i<n-1;i++)
    				{
    					ans+=(long)arr[li];
    					li--;
    				}
    				ans+=arr[0];
    				pw.println(ans);

    			}
    			  */

    			pw.close();

    	   }

    		   static  class MyScanner
    			{

    			BufferedReader br;
    			StringTokenizer st;

    			public MyScanner()
    			{
    				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;
    			}

    		}

    		static MyScanner sc = new  MyScanner();
    		static PrintWriter pw = new PrintWriter(System.out, true);

    		static class DisjointSet
    		{
    			int[] parent;
    			int[] rank;
    			int n;

    			public DisjointSet(int x)
    			{
    				n=x;
    				parent = new int[x];
    				rank = new int[x];

    				for(int i=0;i<n;i++)
    				{
    					parent[i]=i;
    				}

    			}

    			public int find(int x)
    			{

    				if(parent[x]==x)
    					return x;
    				else
    					return find(parent[x]);
    			}

    			public void union(int i, int j)
    			{
    				int iroot = find(i);
    				int jroot = find(j);

    				if(iroot==jroot)
    					return;

    				if(rank[iroot]<rank[jroot])
    				{
    					parent[iroot]=jroot;

    				}
    				else if(rank[jroot]<rank[iroot])
    				{
    					parent[jroot]=iroot;
    				}
    				else
    				{
    					parent[iroot]=jroot;
    					rank[jroot]++;

    				}

    			}

    		}

    	}

import java.io.*;
import java.util.*;

public class Solution{   //int[] pass by reference???

	static int mod(int a){
		int b=a%14;
		if(b==0)return 14;
		else return b;
	}

	static int cal(int[] a, int ind){
		if(a[ind]==0)return 0;
		int sum=0,i,temp;
		temp=a[ind];
		a[ind]=0;
		for(i=1;i<=14;i++){
			a[i]+=temp/14;
		}
		temp=temp%14;

		for(i=ind+1;;i++){
			if(temp==0)break;
			else{
				a[mod(i)]++;
				temp--;
			}
		}

		for(i=1;i<=14;i++){
			if(a[i]%2==0)sum+=a[i];
		}
		return sum;
	}

 public static void main(String[] args) {

     Scanner in = new Scanner(System.in);

     int n,i,j,max=0;
     int[] a=new int[15];

     for(i=1;i<=14;i++)a[i]=in.nextInt();

     for(i=1;i<=14;i++){
    	 int[] b=new int[15];
    	 for(j=1;j<=14;j++)b[j]=a[j];

    	 int temp=cal(b,i);
    	 if(temp>max)max=temp;
     }

     System.out.println(max);
 }
}

import java.util.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;

public class Main
{

  public static void main(String[] args) throws Exception
  {
    long startTime = System.nanoTime();
    int [] data = new int[14];
    for(int i=0;i<14;i++){
        data[i] = in.nextInt();
    }
    long ans = 0;
    for(int i=0;i<14;i++){
        ans =Math.max(add(Arrays.copyOf(data,14),i),ans);
    }
    out.println(ans);
    long endTime = System.nanoTime();
    err.println("Execution Time : +" + (endTime-startTime)/1000000 + " ms");
    exit(0);
  }

  static long add(int [] data,int ind){
    int value = data[ind];
    data[ind]=0;
    for(int i=0;i<14;i++){
        data[i]+=value/14;
    }
    int rem = value%14;
    long ans = 0;
    for(int i=ind+1,j=0;j<14 && rem > 0;j++){
        if(i==ind)
            continue;
        if(i==14)
            i=0;
        data[i]++;
        rem--;
        if(data[i]%2==0){
            ans+=data[i];
        }
        i++;
    }
    return ans;
  }

  static class InputReader
  {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        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());
        }

        public double nextDouble(){
           return Double.parseDouble(next());
        }
    }

    static void exit(int a)
    {
      out.close();
      err.close();
      System.exit(a);
    }

    static InputStream inputStream = System.in;
    static OutputStream outputStream = System.out;
    static OutputStream errStream = System.err;
    static InputReader in = new InputReader(inputStream);
    static PrintWriter out = new PrintWriter(outputStream);
    static PrintWriter err = new PrintWriter(errStream);
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

}

import java.util.Scanner;

public class Q2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int[] ar = new int[14];
		for (int i = 0; i < 14; i++) {
			ar[i]=scan.nextInt();
		}
		int maxscore=0;
		for(int i=0; i<14;i++){
			if(ar[i]!=0){
				int score = play(ar,i);
				maxscore=Math.max(maxscore, score);
			}
		}
		System.out.println(maxscore);
	}

	public static int play(int[] ar, int i){
		int temp[]= new int[14];
		for(int k=0;k<14;k++)
			temp[k]=ar[k];
		int score=0;
		int no=ar[i];
		temp[i]=0;
		for(int j=1; j<=no;j++){
			temp[(i+j)%14]=temp[(i+j)%14]+1;
			if(temp[(i+j)%14]%2==0){
				score+=temp[(i+j)%14];
			}

		}

		return score;

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Solution {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		// int n = sc.nextInt();
		int[] arr = new int[14];

		int max = 0;
		int even = 0;
		int index = 0;
		for (int i = 0; i < 14; i++) {
			arr[i] = sc.nextInt();
			// if (arr[i] > max) {
			// max = arr[i];
			// index = i;
			// }
		}

		for (int i = 0; i < 14; i++) {
			int done = arr[i];
			even = 0;
			for (int j = i + 1; j < 140; j++) {
				if (done <= 0)
					break;

				if (arr[j % 14] != 0)
					even += arr[j % 14] + 1;
				done--;
			}
			max = Math.max(max, even);
		}
		System.out.println(max);

	}

	static class Pair {
		int a;
		int b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream System) {
			br = new BufferedReader(new InputStreamReader(System));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() {
			for (long i = 0; i < 3e9; i++)
				;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

import org.omg.PortableInterceptor.DISCARDING;
import org.xml.sax.ext.LexicalHandler;

public class Main implements Runnable{

		 public static void main(String[] args) throws IOException {
			new Thread(null , new Main(),"Main", 1<<26).start();

		 }

		public void run(){
			try {
			PrintWriter out = new PrintWriter(System.out);
			MyScanner sc = new MyScanner();
			solve(out, sc);
			out.close();
			}
			catch (Exception e) {
				e.printStackTrace();

			}
		}

		void solve(PrintWriter out, MyScanner sc){

			int n = 14;
			int[] a = new int[n];
			for(int i = 0 ; i < n ; ++i) {
				a[i] = sc.nextInt();
			}

			long score = 0;
			for(int i = 0; i < n ; ++i) {
				long val = 0;
				if(a[i] == 0) continue;
				int tour = a[i] / n;
				int r = a[i] % n;

				for(int  k = 1 ; k < n ; ++k) {
					int pos = (k + i) % n;
					if((a[pos] + tour + ((r < n)?1:0)) % 2 == 0 ) val += (a[pos] + tour + 1);
				}

				if(tour % 2 == 0) val += tour;

				score = Math.max(score, val);
			}
			out.print(score);

		}

}

class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
       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;
    }

}

import java.util.*;
public class Soluti {
public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int array[]=new int[14];
	for(int i=0;i<14;i++){
		array[i]=sc.nextInt();
	}
	int big=0,sbig=0,insex=0,inbex=0;
	for(int i=0;i<14;i++){
		if(array[i]>big){
		sbig=big;
		big=array[i];
		}

	}
	for(int i=0;i<14;i++){
		if(array[i]==big){

			inbex=i;

		}
		if(array[i]==sbig){

			insex=i;
		}
	}
	if(Math.abs(inbex-insex)>sbig){
		//redist big
		array[inbex]=0;

			int p=big/14;
			if(p>0){for(int i=0;i<array.length;i++){array[i]=array[i]+p;}}
			int sub1=big%14;
			if(sub1>0){
			for(int i=inbex+1;i<array.length;i++){
				if(sub1==0){break;}
				array[i]=array[i]+1;sub1--;
			}
			for(int i=0;i<array.length;i++){
				if(sub1==0){break;}
				array[i]=array[i]+1;sub1--;
			}

		}
	}else{
		array[insex]=0;
			int p=sbig/14;
			if(p>0){for(int i=0;i<array.length;i++){array[i]=array[i]+p;}}
			int sub1=sbig%14;
			if(sub1>0){
			for(int i=insex+1;i<array.length;i++){
				if(sub1==0){break;}
				array[i]=array[i]+1;sub1--;
			}
			for(int i=0;i<array.length;i++){
				if(sub1==0){break;}
				array[i]=array[i]+1;sub1--;
			}
			}

	}

	long sum=0;
	for(int i=0;i<array.length;i++){
		if(array[i]%2==0){sum=sum+array[i];}
	}System.out.println(sum);
	sc.close();
}
}

import java.util.Scanner;
import java.util.Arrays;

public class Mancala {
	public static int[] values;

	public static void main(String[] args)
	{
		Scanner console = new Scanner(System.in);
		values = new int[14];
		for (int i = 0; i<values.length; i++)
			values[i] = console.nextInt();
		int result = generateMangalaResult(values);
		System.out.println(result);
	}

	public static int generateMangalaResult(int[] values)
	{
		int result = Integer.MIN_VALUE;
		for (int i = 0; i<values.length; i++)
		{
			if (values[i] != 0)
			{
				int[] clone = values.clone();
				// System.out.println("This is values: ");
				// System.out.println(Arrays.toString(clone));
				int tempRes = generateMangalaResultWithRemov(clone, i);
				if (tempRes > result)
					result = tempRes;
			}
		}
		return result;
	}

	public static int generateMangalaResultWithRemov(int[] values, int index)
	{
		int startingInt=index+1;
		int incAll = values[index]/14;
		for (int i = 0; i<values.length; i++)
		{
			values[i]+=incAll;
		}
		int stonesLeft = values[index]%14;
		values[index] = 0;
		while (stonesLeft != 0)
		{
			stonesLeft--;
			values[startingInt%14]++;
			startingInt++;
		}
		int result = 0;
		for (int i = 0; i<values.length; i++)
		{
			if (values[i]%2 == 0)
				result+=values[i];
		}
		return result;
	}
}

import java.util.*;
public class ProblemB {
    public static int[] ori_Value;
    public static void main(String[] argc)
    {
        Scanner sc = new Scanner(System.in);
        ori_Value = new int[14];
        for(int i = 0; i < 14; i++)
            ori_Value[i] = sc.nextInt();

        // System.out.println(ori_Value[2]);
        // Find first maximum value
        int max_Value = 0;
        int max_Idx = 0;
        for(int i = 0; i < 14; i++)
        {
            if(ori_Value[i] >= max_Value)
            {
                max_Value = ori_Value[i];
                max_Idx = i;
            }
        }

        //Possible duplicate max
        ArrayList<Integer> max_Idx_List = new ArrayList<>();
        for(int i = 0; i < 14; i++)
        {
            if(ori_Value[i] == max_Value)
            {
                max_Idx_List.add(i);
            }
        }

        // System.out.println(max_Idx_List.get(0));

        // Distribute after one move
        if (max_Idx_List.size() == 1) // Single max
        {
            max_Idx = max_Idx_List.get(0);
            int sum = 0;
            sum = distrubteAfterOneMove(max_Idx);

            System.out.println(sum);
        }
        else // multiple sum
        {
            int max_Sum = 0;
            for(int i = 0; i < max_Idx_List.size(); i++)
            {
                max_Idx = max_Idx_List.get(i);
                int sum = 0;
                sum = distrubteAfterOneMove(max_Idx);
                if(sum >= max_Sum)
                    max_Sum = sum;

                System.out.println(max_Sum);
            }
        }
    }

    public static int distrubteAfterOneMove(int max_Idx)
    {
        int distribute_sum =  ori_Value[max_Idx];

        int[] cloned_Value = new int[ori_Value.length];
        for(int i = 0; i < ori_Value.length; i++)
            cloned_Value[i] = ori_Value[i];

        cloned_Value[max_Idx] = 0;

        if((13 - max_Idx) >= distribute_sum)
        {
            int pos = max_Idx + 1;
            while(distribute_sum > 0)
            {
                cloned_Value[pos] += 1;
                distribute_sum--;
                pos++;
            }
        }
        else
        {
            int pos = max_Idx + 1;
            while( pos <= 13)
            {
                cloned_Value[pos] += 1;
                distribute_sum--;
                pos++;
            }

            int div = distribute_sum / 14;
            int rem = distribute_sum % 14;
            //System.out.println(div + "\t" + rem);

            for(int i = 0; i < 14; i++)
                cloned_Value[i] += div;
            for(int i = 0; i < rem; i++)
                cloned_Value[i] += 1;
        }

        int sum = 0;
        for(int i = 0; i < 14; i++)
        {
            if(cloned_Value[i]%2 ==0)
                sum += cloned_Value[i];
        }
        return sum;
    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class D {

    long MODULO = 1L * 1000 * 1000 * 1000 * 1000 * 1000 ;
    long b = 31;
    String fileName = "";
    class Point{
        int x, y;
        Point(int x, int y){
            this.x = x;
            this.y = y;
        }
    }

    //////////////////////    SOLUTION   SOLUTION  SOLUTION    //////////////////////////////
    int INF = Integer.MAX_VALUE;
    class Segment implements Comparable<Segment>{
        int start, end, ind;
        Segment(int start, int end, int ind){
            this.start = start;
            this.end = end;
            this.ind = ind;
        }

        @Override
        public int compareTo(Segment o) {
            if(this.start == o.start){
                return -Integer.compare(this.end, o.end);
            }
            return Integer.compare(this.start, o.start);
        }
    }
    void solve() throws IOException {
        int n = 14;
        int[] a = readIntArray(n);
        long ans = 0;
        for(int i=0; i<n; ++i){
            int[] curArr = new int[n];
            for(int j=0; j<n; ++j){
                curArr[j] = a[j];
            }
            int plusAll = a[i] / 14;
            int mod = a[i] % 14;
            curArr[i] += plusAll;
            long curSum = 0;
            if(curArr[i] %2 == 0){
                curSum += curArr[i];
            }
            for(int j=i+1; j < i + 14; ++j){
                curArr[j % n] += plusAll;
                if(mod > 0){
                    curArr[j % n]++;
                    mod--;
                }
                if(curArr[j % n] % 2 == 0){
                    curSum += curArr[j % n];
                }
            }
            ans = Math.max(ans, curSum);
        }
        out.println(ans);
    }
    class Pair implements Comparable<Pair>{
        long a, b;
        Pair(long a, long b){
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Pair o) {

            return -Long.compare(Math.max(this.a - this.b, 0), Math.max(o.a - o.b, 0));
        }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////
    int binSearchRight(int[] a, int val){
        int l = -1;
        int r = a.length;
        while(r - l > 1){
            int mid = (r+l)/2;
            if(a[mid] >= val){
                r = mid;
            }else{
                l = mid;
            }
        }
        return r == a.length ? INF :a[r];
    }
    int binSearchLeft(int[] a, int val){
        int l = -1;
        int r = a.length;
        while(r - l > 1){
            int mid = (r+l)/2;
            if(a[mid] <= val){
                l = mid;
            }else{
                r = mid;
            }
        }
        return l == -1 ? -1 : a[l];
    }
    class SparseTable{
        int[][] rmq;
        int[] logTable;
        int n;
        SparseTable(int[] a){
            n = a.length;
            logTable = new int[n+1];
            for(int i = 2; i <= n; ++i){
                logTable[i] = logTable[i >> 1] + 1;
            }
            rmq = new int[logTable[n] + 1][n];
            for(int i=0; i<n; ++i){
                rmq[0][i] = a[i];
            }

            for(int k=1; (1 << k) < n; ++k){
                for(int i=0; i + (1 << k) <= n; ++i){
                    int max1 = rmq[k - 1][i];
                    int max2 = rmq[k-1][i + (1 << (k-1))];
                    rmq[k][i] = Math.max(max1, max2);
                }
            }
        }

        int max(int l, int r){
            int k = logTable[r - l];
            int max1 = rmq[k][l];
            int max2 = rmq[k][r - (1 << k) + 1];
            return Math.max(max1, max2);
        }
    }
    long checkBit(long mask, int bit){
        return (mask >> bit) & 1;
    }
    class Dsu{
        int[] parent;
        int countSets;
        Dsu(int n){
            countSets = n;
            parent = new int[n];
            for(int i=0; i<n; ++i){
                parent[i] = i;
            }
        }
        int findSet(int a){
            if(parent[a] == a) return a;
            parent[a] = findSet(parent[a]);
            return parent[a];
        }
        void unionSets(int a, int b){
            a = findSet(a);
            b = findSet(b);
            if(a!=b){
                countSets--;
                parent[a] = b;
            }
        }
    }
    static int checkBit(int mask, int bit) {
        return (mask >> bit) & 1;
    }
    boolean isLower(char c){
        return c >= 'a' && c <= 'z';
    }

    ////////////////////////////////////////////////////////////

    class SegmentTree{
        int[] t;
        int n;
        SegmentTree(int n){
            t = new int[4*n];
            build(new int[n+1], 1, 1, n);
        }
        void build (int a[], int v, int tl, int tr) {
            if (tl == tr)
                t[v] = a[tl];
            else {
                int tm = (tl + tr) / 2;
                build (a, v*2, tl, tm);
                build (a, v*2+1, tm+1, tr);
            }
        }

        void update (int v, int tl, int tr, int l, int r, int add) {
            if (l > r)
                return;
            if (l == tl && tr == r)
                t[v] += add;
            else {
                int tm = (tl + tr) / 2;
                update (v*2, tl, tm, l, Math.min(r,tm), add);
                update (v*2+1, tm+1, tr, Math.max(l,tm+1), r, add);
            }
        }

        int get (int v, int tl, int tr, int pos) {
            if (tl == tr)
                return t[v];
            int tm = (tl + tr) / 2;
            if (pos <= tm)
                return t[v] + get (v*2, tl, tm, pos);
            else
                return t[v] + get (v*2+1, tm+1, tr, pos);
        }
    }
    class Fenwik {
        long[] t;
        int length;

        Fenwik(int[] a) {
            length = a.length + 100;
            t = new long[length];

            for (int i = 0; i < a.length; ++i) {
                inc(i, a[i]);
            }
        }

        void inc(int ind, int delta) {
            for (; ind < length; ind = ind | (ind + 1)) {
                t[ind] += delta;
            }
        }

        long getSum(int r) {
            long sum = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += t[r];
            }
            return sum;
        }
    }
    int gcd(int a, int b){
        return b == 0 ? a : gcd(b, a%b);
    }

    long binPow(long a, long b, long m) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 1) {
            return ((a % m) * (binPow(a, b - 1, m) % m)) % m;
        } else {
            long c = binPow(a, b / 2, m);
            return (c * c) % m;
        }

    }
    int minInt(int... values) {
        int min = Integer.MAX_VALUE;
        for (int value : values) min = Math.min(min, value);
        return min;
    }

    int maxInt(int... values) {
        int max = Integer.MIN_VALUE;
        for (int value : values) max = Math.max(max, value);
        return max;
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        // TODO Auto-generated method stub
        new D().run();
    }

    void run() throws NumberFormatException, IOException {
        solve();
        out.close();
    };

    BufferedReader in;
    PrintWriter out;

    StringTokenizer tok;
    String delim = " ";
    Random rnd = new Random();

    D() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }

        }
        tok = new StringTokenizer("");
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine) {
                return null;
            }

            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken();
    }

    int readInt() throws NumberFormatException, IOException {
        return Integer.parseInt(readString());
    }
    byte readByte() throws NumberFormatException, IOException {
        return Byte.parseByte(readString());
    }
    int[] readIntArray (int n) throws NumberFormatException, IOException {
        int[] a = new int[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }

    Integer[] readIntegerArray (int n) throws NumberFormatException, IOException {
        Integer[] a = new Integer[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }

    long readLong() throws NumberFormatException, IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(readString());
    }
}

import java.util.Scanner;

public class B975 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] A = new int[14];
        for (int i=0; i<14; i++) {
            A[i] = in.nextInt();
        }
        long max = 0;
        for (int from=0; from<14; from++) {
            int a = A[from];
            long score = a/14;
            for (int i=1; i<14; i++) {
                int count = A[(from+i)%14] + (a+14-i)/14;
                if (count%2 == 0) {
                    score += count;
                }
            }
            max = Math.max(max, score);
        }
        System.out.println(max);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int[] board=fs.readArray(14);
		long max=0;
		for (int i=0; i<14; i++)
			max=Math.max(max, countPoints(board.clone(), i));
		System.out.println(max);
	}

	static long countPoints(int[] board, int toShare) {
		int[] toDist=new int[14];
		int oStones=board[toShare];
		for (int i=0; i<13; i++)
			toDist[i]=(oStones-i+13)/14;
		for (int d=0; d<14; d++) {
			board[(toShare+1+d)%14]+=toDist[d];
		}
		board[toShare]=0;
		long total=0;
		for (int i:board)
			if (i%2==0)
				total+=i;
		return total;
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();

		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++)
				a[i]=nextInt();
			return a;
		}
	}

}

import java.util.*;
public class Mancala {
	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int[] a=new int[14];
		int[] b=new int[14];
		int sum=0,max=0;
		for(int i=0;i<14;i++)
		{
			b[i]=in.nextInt();
		}
		for(int i=0;i<14;i++)
		{
			for(int t=0;t<14;t++)
			{
				a[t]=b[t];
			}
			int temp=a[i];
			sum=0;
			a[i]=0;
			int fractionpart=temp/14;
			for(int j=0;j<14;j++) {
				a[j]=a[j]+fractionpart;
			}
			int y=temp%14;
			int next=i+1;
			for(int j=y;j>=1;j--)
			{
				a[next%14]++;
				next++;
			}
			for(int k=0;k<14;k++)
			{
				if(a[k]%2==0)
				{
					sum=sum+a[k];
				}
			}
			if(max<sum)
			{
				max=sum;
			}
		}
		System.out.println(max);
	}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class ProblemB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        List<Long> l = Arrays.stream(in.nextLine()
                .split(" "))
                .map(Long::valueOf).collect(Collectors.toList());

        Long max = Long.MIN_VALUE;
        for (int i = 0; i < l.size(); i++) {
            Long n = l.get(i);
            if (n.equals(0)) continue;

            List<Long> lcopy = new ArrayList<>(l);

            long add = n / 14;
            int j = i;
            lcopy.set(i, 0L);
            if (add != 0) {
                while (true) {
                    j = j + 1;
                    if (j == lcopy.size()) {
                        j = 0;
                    }
                    if (j == i) {
                        break;
                    }
                    lcopy.set(j, lcopy.get(j) + add);
                }
            }

            long i1 = n % 14;
            if (i1 != 0) {
                j = i;
                while (true) {
                    if (i1 == 0) {
                        break;
                    }
                    j = j + 1;
                    if (j == lcopy.size()) {
                        j = 0;
                    }
                    if (j == i && i1 != 0) {
                        break;
                    }
                    i1--;
                    lcopy.set(j, lcopy.get(j) + 1);
                }
            }

            max = Long.max(max, lcopy.stream().filter(v -> v % 2 == 0).mapToLong(v -> v).sum());
        }
        System.out.println(max);
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = 14;
		int max = 0;
		int[] ar = new int[14];
		for(int i=0;i<n;i++){
			ar[i]=in.nextInt();
		}
		for(int i = 0; i<n;i++){
			int temp[] = new int[14];
			for(int j=0;j<n;j++){
				temp[j]=ar[j];
			}
			int m = ar[i];
			if(m>0){
				int a = m/14;
				int r = m%14;
				for(int j = 0;j<n;j++){
					temp[j]+=a;
				}

				int tempi = i;
				for(int j=0;j<r;j++){

					if(tempi==13){
						temp[0]+=1;
						tempi=0;
					}else{
						temp[tempi+1]+=1;
						tempi++;
					}
				}
				int tempm=0;

				for(int j=0;j<n;j++){
					if(temp[j]%2==0){
						tempm+=temp[j];
					}
				}

				if(max<tempm){

					max = tempm;}
			}

		}

		System.out.println(max);

	}

}

import java.util.*;
import java.lang.*;

public class CF_20180501_B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.nextLine();
        // String in = "0 1 1 0 0 0 0 0 0 999999999 0 0 0 0";
        String[] input = in.split(" ");
        HashMap<Integer, Integer> orgMap = new HashMap<Integer, Integer>();
        int maxScore = 0;
        for (int i=0; i < input.length; i++) {
            orgMap.put(i, Integer.parseInt(input[i])); // pos, value pair
        }
        for (Map.Entry me : orgMap.entrySet()) {
            HashMap<Integer, Integer> tmpMap = new HashMap<Integer, Integer>(orgMap);
            Integer val = (Integer) me.getValue();
            if (val == 0) {
                continue;
            } else {
                Integer curPos = (Integer) me.getKey();
                tmpMap.put(curPos, 0);
                int score = 0;
                for (int i=1; i <= val%14; i++) {
                    tmpMap.put((curPos+i)%14, tmpMap.get((curPos+i)%14)+((val/14) + (val % 14 >= i ? 1 : 0)));
                }
                for (Map.Entry me2 : tmpMap.entrySet()) {
                    score += (((Integer) me2.getValue() % 2 == 0) ? (Integer) me2.getValue() : 0);
                }
                maxScore = maxScore > score ? maxScore : score;
//  System.out.println(score);
            }
        }
        System.out.println(maxScore);
        System.exit(0);
    }
}

import java.util.*;
import java.io.*;
public class Mancala {
  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 void main(String[]args){
      FastReader input = new FastReader();
      int[] arr = new int[14];
      for(int i = 0;i < 14;i++){
        arr[i] = input.nextInt();
      }
      int record = -1;
      int sum = 0;
     for(int i = 0;i < 14;i++){
        int[] arr2 = new int[arr.length];
        for(int a = 0;a < arr.length;a++){
          arr2[a] = arr[a];
        }
     /*   System.out.println("The array");
        for(int y : arr2){
          System.out.print(y + " ");
        }
        System.out.println(); */
     /*   for(int j = 0;j < arr2.length;j++){
          if(arr2[j] > 0 && j > record){
            record = j;
           // System.out.println("record = "+record);
            int p = arr2[j] / 14;
            int q = arr2[j] % 14;
            arr2[j] = 0;
            int key = j+1;
            if(key == 14) key = 0;
            int key2 = j+1;
            if(key2 == 14) key2 = 0;
            int count = 0;
            if(p > 0){
              while(count <= 14){
                arr2[key] = arr2[key] + p;
                key++;
                if(key == 14) key = 0;
                count++;
              }

            }
            if(q > 0){
              while(q > 0){
                arr2[key2++]++;
                q--;
                if(key2 == 14) key2 = 0;
              }
            }
            break;
          }
        } */
          for(int j = 0;j < arr2.length;j++){
            if(arr2[j] > 0 && j > record){
              record = j;
              int num = arr2[j];
              arr2[j] = 0;
              int p = j+1;
              int q = j + 1;
              if(p == 14) p = 0;
              if(q == 14) q = 0;
              int k = num / 14;
              int l = num % 14;
              int count1 = 0;
              if(k > 0){
                   while(count1 < 14){
                arr2[p] = arr2[p] + k;
                p++;
                if(p == 14) p = 0;
                count1++;
              }
              }

             if(l > 0){
               while(l > 0){
                 arr2[q++]++;
                 if(q == 14) q = 0;
                 l--;
               }
             }

              break;
            }
          }
        int sum2 = 0;
        for(int t : arr2){
      //    System.out.print(t + " ");
          if((t % 2) == 0){
            sum2 += t;
          }
        }
     //   System.out.println();
       if(sum2 > sum){
         sum = sum2;
       }
     }
     System.out.println(sum);

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class C_975_B {

    private void solve() throws IOException {

        int[] arr = nextArr(14);
        Set<Integer> set = new HashSet<>();

        for (int i = 0; i < arr.length; i++) {
//            if (arr[i] == 0) continue;

            int current = i;
            int scores = arr[i];
            int amount = 0;
            while (scores != 0) {
                if (current == 13) current = 0;
                else current++;
                int curElem = arr[current];
                int resEl = curElem + 1;
                amount += resEl % 2 == 0 ? resEl : 0;
                scores--;
            }

            set.add(amount);
        }

//        System.out.println(Arrays.toString(set.toArray()));
        List<Integer> list = new ArrayList<>(set);
        Collections.sort(list);
        System.out.println(list.get(list.size() - 1));
    }

    public static void main(String[] args) {
        new C_975_B().run();
    }

    StringTokenizer tokenizer;
    BufferedReader reader;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextInt();
        return arr;
    }

    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextLong();
        return arr;
    }

    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextDouble();
        return arr;
    }

}

import java.util.*;
import java.io.*;

public class Mancala {

	void solve(Scanner in, PrintWriter out) {
		long[] orig = new long[14];
		for (int i = 0; i < 14; i++)
			orig[i] = in.nextInt();
		long max = Long.MIN_VALUE;

		for (int i = 0; i < 14; i++) {
			long[] arr = orig.clone();
			int chosen = i;
			long coins = arr[chosen];
			for (int j = chosen + 1; j < 14; j++) {
				if (coins > 0) {
					arr[j]++;
					coins--;
				}

			}

			if (coins >= 14) {
				long times = coins / 14;
				for (int j = 0; j < 14; j++)
					arr[j] += times;
			}
			long rem = coins % 14;
			for (int j = 0; j < rem; j++)
				arr[j]++;

			long t = 0;

			for (int j = 0; j < 14; j++) {
				if (arr[j] % 2 == 0)
					t += arr[j];
			}
			max = Math.max(t, max);

		}
		out.println(max);

	}

	void run() {
		try (Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out);) {
			solve(in, out);
		}
	}

	public static void main(String args[]) {
		new Mancala().run();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String args[]) throws IOException {
		Scanner sc=new Scanner (System.in);
		int arr[]=new int [14];
		int max=-1;
		for(int i=0;i<14;i++) {
			arr[i]=sc.nextInt();
		}
		int arro[]=arr.clone();
		for(int i=0;i<14;i++) {
			arr=arro.clone();
			int M=arr[i]/14;

			int rem=arr[i]%14;
			arr[i]=0;
			for(int j=0;j<14;j++)
				arr[j]+=M;
			int c=0;
			//System.out.println(rem);
			for(int j=i+1;c<rem;j++) {
				if(j==14)j=0;
				arr[j]++;c++;
				///System.out.println(Arrays.toString(arr));
			}

			int sum=0;
			for(int l=0;l<14;l++) {
				if(arr[l]%2==0)sum+=arr[l];
			}

			max=Math.max(sum, max);
		}
		System.out.println(max);

	}
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine(), ",| ");
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public boolean ready() throws IOException {return br.ready();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

	}}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            long tmpHoles[];
            long holes[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readLong();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                tmpHoles = holes.clone();

                for (int j = 0; j < HOLES; j++) {
                    tmpHoles[j] += holes[i] / HOLES;
                }
                tmpHoles[i] = 0;
                long stones = holes[i] % HOLES;
                int indx = i + 1;
                while (stones > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx];
                    --stones;
                    ++indx;
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if (tmpHoles[j] % 2 == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args)  throws Exception{
		Scanner sc = new Scanner (System.in);
		long [] a = new long [14];
		long max = 0;
		for(int i = 0 ; i< 14 ; i++)
			a[i] = sc.nextInt();

		for(int i = 0 ; i<14 ;i++)
		{
			long [] b = a.clone();
			long count = a[i];
			for(int j = (i+1)%14 ; count-->0 ;j= (j+1)%14)
			{

				b[j]++;
				long res = 0 ;
				for(int k  =0 ; k<14 ;k++)
					if(b[k] % 2  == 0)
						res+=b[k];

				max = Math.max(res, max);

			}

		}

		System.out.println(max);

	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            int holes[] = new int[HOLES];
            long tmpHoles[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readInteger();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                copyArray(holes, tmpHoles);

                long stones = tmpHoles[i];
                int indx = i + 1;
                while (stones > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx];
                    --stones;
                    ++indx;
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if (tmpHoles[j] % 2 == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

        private void copyArray(int[] source, long[] target) {
            for (int i = 0; i < HOLES; i++) {
                target[i] = source[i];
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInteger() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class cdfpc2a
{
	static void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }
    static int gcd(int a, int b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }
    static long power(long n,long m)
    {
    	if(m==0)
    		return 1;
    	long ans=1;
    	while(m>0)
    	{
    		ans=ans*n;
    		m--;
    	}
    	return ans;
    }
	static int binarySearch(ArrayList<Integer> arr, int x)
    {
        int l = 0, r = arr.size() - 1,m=l + (r - l) / 2;
        while (l <= r) {
            m = l + (r - l) / 2;
            if (arr.get(m) == x)
                return m;
            if (arr.get(m) < x)
                l = m + 1;
            else
                r = m - 1;
        }
        return (int)Math.max(l, m);
    }
	public static void main(String args[])throws Exception
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=1;//Integer.parseInt(br.readLine());
	    for(int i=1;i<=t;i++)
	    {
	        int n;
	        String s=br.readLine();
	        String ss[]=s.split(" ");
	        int arr[]=new int[14];
	        long sum=0,max=0;
	        for(int j=0;j<14;j++)
	        {
	        	arr[j]=Integer.parseInt(ss[j]);
	        }

	        for(int j=0;j<14;j++)
	        {
	        	sum=0;
	        	int temp=arr[j]%14;
	        	int tt=arr[j]/14;
	        	if(tt%2==0)
	        		sum+=tt;
	        	for(int k=j+1,l=0;l<14;l++,k++)
	        	{
	        		long tempo=arr[k%14]+(arr[j]/14);
	        		if(temp>0)
	        		{
	        			tempo++;
	        			temp--;
	        		}
	        		if(tempo%2==0)
	        			sum+=tempo;
	        	}
	        	if(sum>max)
	        		max=sum;
	        }
	        	System.out.println(max);
	    }
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class scratch_16{
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        long arr[]= new long[14];
        int max1=0;
        long max=0;
        for (int i = 0; i <14 ; i++) {
            arr[i]= sc.nextInt();
            if(arr[i]>max){
                max=arr[i];
                max1=i;
            }
        }
        leftRotate(arr,max1+1,14);
       // System.out.println(Arrays.toString(arr));
        arr[13]=0;
        long f= max/14;
        long g= max%14;
        for (int i = 0; i <14 ; i++) {
            arr[i]+=f;
        }
        for (int i = 0; i <=g ; i++) {
            arr[i]+=1;
        }
        int ans=0;
        for (int i = 0; i <14 ; i++) {
            if(arr[i]%2==0 && arr[i]!=0){
                ans+=arr[i];
            }
        }
      //  System.out.println(Arrays.toString(arr));
        System.out.println(ans);

    }
   static void leftRotate(long arr[], int d, int n)
    {
        for (int i = 0; i < d; i++)
            leftRotatebyOne(arr, n);
    }

    static void leftRotatebyOne(long arr[], int n)
    {
        int i;
        long temp;
        temp = arr[0];
        for (i = 0; i < n - 1; i++)
            arr[i] = arr[i + 1];
        arr[i] = temp;
    }
}

//codeforces_975B

import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.lang.Math.*;

public class acm{

	public static void main(String args[]) throws IOException,FileNotFoundException {
		BufferedReader gi = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter go = new PrintWriter(System.out);
		int[] line = parseArray(gi.readLine().split(" "));
		int div,rem;
		int temp = 0,rez = 0;
		int cnd;
		for (int k = 0; k<14; k++){
			if (line[k] == 0){ continue; }
			div = line[k]/14;
			rem = line[k]%14;
			temp = 0;
			cnd = div%2==0?0:1;
			for (int j = k+1; j<=k+rem; j++){
				if ((line[j%14]+cnd+1)%2==0){ temp += line[j%14] + 1; }
			}
			for (int j = k+rem+1; j<13+k; j++){
				if ((line[j%14]+cnd)%2==0){ temp+= line[j%14]; }
			}
			if (div%2 != 0){ div--; }
			rez = max(rez,temp + div * 14);
		}
		go.println(rez);
		go.close();
	}

	static int[]  parseArray(String[] line){
		int len = line.length;
		int A[] = new int[len];
		int k = 0;
		for (String e : line){
			A[k++] = Integer.parseInt(e);
		}
		return A;
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class macala {
public static void main(String[] args) {
	Scanner sc= new Scanner(System.in);
	int []elm =new int[14];
	for (int i = 0; i < elm.length; i++) {
		elm[i] = sc.nextInt();
	}
	int max = 0;
	for (int i = 0; i < elm.length; i++) {
		int [] tmp =Arrays.copyOf(elm, elm.length);
		int cur = tmp[i];
		tmp[i]= 0;
		cur-=cur/14;
		for (int j = 0; j < tmp.length; j++) {
			tmp[j]+=cur/14;
		}
		for (int j = i+1; j < tmp.length; j++) {
			if(cur==0)
				break;
			tmp[j]++;
			cur--;
		}
		for (int j = 0; j < i; j++) {
			if(cur==0)
				break;
			tmp[j]++;
			cur--;
		}
		int ansTmp =0;
		for (int j = 0; j < tmp.length; j++) {
			if(tmp[j]%2==0)
				ansTmp+=tmp[j];
		}
		max = Math.max(max, ansTmp);

	}
	System.out.println(max);
}
}

import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.io.*;
		public final class Solution {
		static PrintWriter out = new PrintWriter(System.out);
		static void flush() {
	 	out.flush();
	 	}
		static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;

	    public FastReader() {
	    br = new BufferedReader(new
	    InputStreamReader(System.in));
	    }
	    static boolean isPalindrome(String str1, String str2) {
	    String str3 = str1+str2;
	    int i = 0, j = str3.length()-1;
	    while(i < j) {
	    char a = str3.charAt(i), b = str3.charAt(j);
	    if(a != b) return false;
	    i++;j--;
	    }
	    return true;
	    }
	    static boolean isPalindrome(String str) {
	    int i = 0, j = str.length()-1;
	    while(i < j) {
	    char a = str.charAt(i), b = str.charAt(j);
	    if(a != b) return false;
	    i++;j--;
	    }
	    return true;
	    }
	    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());}
	    static int fact(int n) {
	    if(n == 1) return 1;
	    return n * fact(n-1);
	   	}
	    public int[] readIntArray(int n) {
	    int[] arr = new int[n];
		for(int i=0; i<n; ++i)
		arr[i]=nextInt();
		return arr;
		}
	    public int[][] readIntArray(int m, int n){
		int[][] arr = new int[m][n];
		for(int i = 0;i<m;i++)
		for(int j = 0;j<n;j++)
		arr[i][j] = nextInt();
		return arr;
	    }
	    public String[] readStringArray(int n) {
		String[] arr = new String[n];
		for(int i=0; i<n; ++i)
		arr[i]= nextLine();
		return arr;
	    }
		static int gcd(int a, int b) {
		if (b == 0) return a;
		return gcd(b, a % b);
		}
	    double nextDouble() {return Double.parseDouble(next());}
	    String nextLine() {
	    String str = "";
	    try{str = br.readLine();}
	    catch (IOException e) {e.printStackTrace();}
	    return str;}
	    }

		static int solve(int[] arr1) {
			int n = 14;
			int max = -1;

			for(int i = 0;i<n;i++) {
				int[] arr = new int[14];
				for(int k = 0;k<n;k++) {
					arr[k] = arr1[k];
				}
				int x = arr[i]%14;
				int y = arr[i]/14;
				arr[i] = 0;
				int res = 0;
				int j = 0;
				for(j = i+1;j<n;j++) {
					arr[j] += y;
				}
				for(j = 0;j<=i;j++) {
					arr[j] += y;
				}
				if(x != 0) {
				int k = j;
				while(x != 0) {
					if(k == n) {
						k = 0;
					}
					arr[k] += 1;
					x--;
					k++;
				}
				}
				for(int l = 0;l<n;l++) {
					if(arr[l]%2 == 0) {
						res += arr[l];
					}
				}
				if(res > max) {
					max = res;
				}
			}
			return max;
		}
		public static void main(String args[]) throws Exception {
	    FastReader sc = new FastReader();
	    long start = System.currentTimeMillis();
	    int[] arr = sc.readIntArray(14);
		out.println(solve(arr));
	    flush();
	    long end = System.currentTimeMillis();
	    NumberFormat formatter = new DecimalFormat("#0.00000");
	    //System.out.print("Execution time is " + formatter.format((end - start) / 1000d) + " seconds");
	    }
	}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 *
 * @author SNEHITH
 */
public class problem_B {
    public static void main(String[] args){
        int arr[] = new int[14];
        int arr1[] = new int[14];
        int max=-1;
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<14;i++)
        arr[i] = sc.nextInt();
        for(int j=0;j<14;j++)
            arr1[j] = arr[j];
        for(int i=0;i<14;i++){
            int cur = arr[i];
            int count = 0,res_temp=0,remainder=0;
            arr[i] = 0;
            for(int j=(i+1)%14;remainder<(cur/14)*14;j=(j+1)%14,remainder++){
                arr[j] += cur/14;
            }
            remainder = cur%14;
            for(int j=(i+1)%14;count<remainder;count++,j=(j+1)%14){
                arr[j] += 1;
            }
//            for(int k=0;k<14;k++){
//            System.out.print(" "+arr[k]);
//            }
//            System.out.println();
            arr[i] = cur;
            for(int j=0;j<14;j++)
                if(arr[j]%2 == 0)
                    res_temp += arr[j];
            max = Math.max(res_temp, max);
            for(int j=0;j<14;j++)
                arr[j] = arr1[j];
        }
        System.out.println(max);
    }
}

import java.util.*;

public class keks {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < 14; i++) {
            a.add(in.nextInt());
        }
        int max = 0;
        for (int i = 0; i<14; i++) {
            ArrayList<Integer> b = new ArrayList<>(a);
            int h = a.get(i);
            b.set(i, 0);
            if (h > 0) {
                int g = h/14;
                for (int k = 1; k<=14; k++) {
                    int index = (i+k)%14;
                    b.set(index, b.get(index) + g);
                }
                h %= 14;
                for (int k = 1; k<=h; k++) {
                    int index = (i+k)%14;
                    b.set(index, b.get(index) + 1);
                }
                int c = 0;
                for (int k = 0; k<14; k++) {
                    if (b.get(k) % 2 == 0) c += b.get(k);
                }
                if (c > max) max = c;
//                for (int k = 0; k < 14; k++) {
//                    System.out.print(b.get(k));
//                }
//                System.out.println();
            }
        }
        System.out.println(max);
    }
}

import java.util.*;
public class ProblemB {
    public static int[] ori_Value;
    public static void main(String[] argc)
    {
        Scanner sc = new Scanner(System.in);
        ori_Value = new int[14];
        for(int i = 0; i < 14; i++)
            ori_Value[i] = sc.nextInt();

        // System.out.println(ori_Value[2]);
        // Find first maximum value
        int max_Value = 0;
        int max_Idx = 0;
        for(int i = 0; i < 14; i++)
        {
            if(ori_Value[i] >= max_Value)
            {
                max_Value = ori_Value[i];
                max_Idx = i;
            }
        }

        //Possible duplicate max
        ArrayList<Integer> max_Idx_List = new ArrayList<>();
        for(int i = 0; i < 14; i++)
        {
            if(ori_Value[i] == max_Value)
            {
                max_Idx_List.add(i);
            }
        }

        // System.out.println(max_Idx_List.get(0));

        // Distribute after one move
        if (max_Idx_List.size() == 1) // Single max
        {
            max_Idx = max_Idx_List.get(0);
            int sum = 0;
            sum = distrubteAfterOneMove(max_Idx);

            System.out.println(sum);
        }
        else // multiple sum
        {
            int max_Sum = 0;
            for(int i = 0; i < max_Idx_List.size(); i++)
            {
                max_Idx = max_Idx_List.get(i);
                int sum = 0;
                sum = distrubteAfterOneMove(max_Idx);
                if(sum >= max_Sum)
                    max_Sum = sum;

                System.out.println(max_Sum);
            }
        }
    }

    public static int distrubteAfterOneMove(int max_Idx)
    {
        int distribute_sum =  ori_Value[max_Idx];

        int[] cloned_Value = new int[ori_Value.length];
        for(int i = 0; i < ori_Value.length; i++)
            cloned_Value[i] = ori_Value[i];

        cloned_Value[max_Idx] = 0;

        if((13 - max_Idx) >= distribute_sum)
        {
            int pos = max_Idx + 1;
            while(distribute_sum > 0)
            {
                cloned_Value[pos] += 1;
                distribute_sum--;
                pos++;
            }
        }
        else
        {
            int pos = max_Idx + 1;
            while( pos <= 13)
            {
                cloned_Value[pos] += 1;
                distribute_sum--;
                pos++;
            }

            int div = distribute_sum / 14;
            int rem = distribute_sum % 14;
            //System.out.println(div + "\t" + rem);

            for(int i = 0; i < 14; i++)
                cloned_Value[i] += div;
            for(int i = 0; i < rem; i++)
                cloned_Value[i] += 1;
        }

        int sum = 0;
        for(int i = 0; i < 14; i++)
        {
            if(cloned_Value[i]%2 ==0)
                sum += cloned_Value[i];
        }
        return sum;
    }
}

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();
	   	int max = 0;
	   	for(int i=0;i<14;i++)
	   	{
	   		int 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++)
	   		{
	   			int temp = 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;
	   		}
	   		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());
	}
}

import java.io.*;
import java.util.StringTokenizer;

public class B {

    FastScanner scanner;
    PrintWriter writer;

    void solve() throws IOException {
        scanner = new FastScanner(System.in);
        writer = new PrintWriter(System.out);

        int n = 14;
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scanner.nextInt();

        long max = 0;

        for (int i = 0; i < n; i++) {
            if (a[i] > 0)
                max = Math.max(max, move(a, i));
        }

        writer.println(max);

        writer.close();
    }

    long move(int[] a, int i) {
        long sum = 0;

        int n = a.length;

        for (int j = 0; j < n; j++) {
            int aj;

            if (i != j)
                aj = a[j];
            else
                aj = 0;

            int off = (j - i + n) % n;

            if (a[i] >= off) {
                aj++;
                aj += (a[i] - off - 1) / n;
            }

            if (aj % 2 == 0)
                sum += aj;
        }

        return sum;
    }

    public static void main(String... args) throws IOException {
        new B().solve();
    }

    static class FastScanner {

        BufferedReader br;
        StringTokenizer tokenizer;

        FastScanner(String fileName) throws FileNotFoundException {
            this(new FileInputStream(new File(fileName)));
        }

        FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        String nextLine() throws IOException {
            tokenizer = null;
            return br.readLine();
        }

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = br.readLine();
                if (line == null) {
                    return null;
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 *
 * @author SNEHITH
 */
public class problem_B {
    public static void main(String[] args){
        int arr[] = new int[14];
        int arr1[] = new int[14];
        int max=-1;
        Scanner sc = new Scanner(System.in);
        for(int i=0;i<14;i++)
        arr[i] = sc.nextInt();
        for(int j=0;j<14;j++)
            arr1[j] = arr[j];
        for(int i=0;i<14;i++){
            int cur = arr[i];
            int count = 0,res_temp=0,remainder=0;
            arr[i] = 0;
            for(int j=(i+1)%14;remainder<14;j=(j+1)%14,remainder++){
                arr[j] += cur/14;
            }
            remainder = cur%14;
            for(int j=(i+1)%14;count<remainder;count++,j=(j+1)%14){
                arr[j] += 1;
            }
//            for(int k=0;k<14;k++){
//                System.out.print(" "+arr[k]);
//            }
            System.out.println();
            for(int j=0;j<14;j++)
                if(arr[j]%2 == 0)
                    res_temp += arr[j];
            max = Math.max(res_temp, max);
            for(int j=0;j<14;j++)
                arr[j] = arr1[j];
        }
        System.out.println(max);
    }
}

import java.util.*;
public class Mancala {
	public static void main(String[] args)
	{
		Scanner in=new Scanner(System.in);
		int[] a=new int[14];
		int[] b=new int[14];
		int sum=0,max=0;
		for(int i=0;i<14;i++)
		{
			b[i]=in.nextInt();
		}
		for(int i=0;i<14;i++)
		{
			for(int t=0;t<14;t++)
			{
				a[t]=b[t];
			}
			int temp=a[i];
			sum=0;
			a[i]=0;
			int fractionpart=temp/14;
			for(int j=0;j<14;j++) {
				a[j]=a[j]+fractionpart;
			}
			int y=temp%14;
			int next=i+1;
			for(int j=y;j>=1;j--)
			{
				a[next%14]++;
				next++;
			}
			for(int k=0;k<14;k++)
			{
				if(a[k]%2==0)
				{
					sum=sum+a[k];
				}
			}
			if(max<sum)
			{
				max=sum;
			}
		}
		System.out.println(max);
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

/**
 * @author thesparkboy
 *
 */
public class A2 {

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n = 14;
		long ans = 0;
		long stones[] = new long[n];
		long temp[] = new long[n];
		for (int j = 0; j < n; j++) {
			stones[j] = in.readLong();
			temp[j] = stones[j];
		}
		for (int i = 0; i < n; i++) {
			if (stones[i] != 0) {
				long incr = stones[i] / 13;
				for (int j = 0; j < n; j++) {
					if (j != i)
						temp[j] += incr;
				}
				temp[i] = 0;
				long left = stones[i] % 13;
				int j = i + 1;
				while (left != 0) {
					if (j == 14) {
						j = 0;
					}
					if (j == i) {
						j++;
						continue;
					}
					temp[j]++;
					j++;
					left--;
				}
				long sum = 0;
				for (int k = 0; k < n; k++) {
					if (temp[k] % 2 == 0) {
						sum += temp[k];
					}
				}
				ans = Math.max(ans, sum);
			}
			for (int j = 0; j < n; j++) {
				temp[j] = stones[j];
			}
		}
		System.out.println(ans);
		out.close();
	}

	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		static boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}
	}

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(outputStream);
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}
	}
}

import java.util.Scanner;

public class Task2 {
	public static void main(String[] args) {
		Long max = (long) 0.0;
		int maxIndex = 0;
		int count = 0;
		Scanner scanner = new Scanner(System.in);
		Long[] stones = new Long[14];
		while (count < 14) {
			Long value = Long.valueOf(scanner.next());
			if (value > max) {
				max = value;
				maxIndex = count;
			}
			stones[count] = value;
			count++;
		}
		scanner.close();
		calculateScore(stones, max, maxIndex);
	}

	private static void calculateScore(Long[] number, Long max, int maxIndex) {
		Long score = (long)0;
		Long remainder = max;
		Long count = (long)1;
		number[maxIndex] = (long)0;
		while (remainder >= 0) {
			number[(int) Math.floorMod(maxIndex + count, (long)14)]++;
			count++;
			remainder--;
		}
		for(int i = 0; i < 14; i++) {
			if (Math.floorMod(number[i], (long)2)  == 0){
				score += number[i];
			}
		}
		System.out.println(score);
	}
}

import java.util.*;
public class ProblemB {
    public static int[] ori_Value;
    public static void main(String[] argc)
    {
        Scanner sc = new Scanner(System.in);
        ori_Value = new int[15];
        for(int i = 1; i <= 14; i++)
            ori_Value[i] = sc.nextInt();

        // System.out.println(ori_Value[2]);
        // Find first maximum value
        int max_Value = 0;
        int max_Idx = 0;
        for(int i = 1; i <= 14; i++)
        {
            if(ori_Value[i] >= max_Value)
            {
                max_Value = ori_Value[i];
                max_Idx = i;
            }
        }

        //Possible duplicate max
        ArrayList<Integer> max_Idx_List = new ArrayList<>();
        for(int i = 1; i <= 14; i++)
        {
            if(ori_Value[i] == max_Value)
            {
                max_Idx_List.add(i);
            }
        }

        // System.out.println(max_Idx_List.get(0));

        // Distribute after one move
        if (max_Idx_List.size() == 1) // Single max
        {
            max_Idx = max_Idx_List.get(0);
            int sum = 0;
            sum = distrubteAfterOneMove(max_Idx);

            System.out.println(sum);
        }
        else // multiple sum
        {
            int max_Sum = 0;
            for(int i = 0; i < max_Idx_List.size(); i++)
            {
                max_Idx = max_Idx_List.get(i);
                int sum = 0;
                sum = distrubteAfterOneMove(max_Idx);
                if(sum >= max_Sum)
                    max_Sum = sum;

                System.out.println(max_Sum);
            }
        }
    }

    public static int distrubteAfterOneMove(int max_Idx)
    {
        int distribute_sum =  ori_Value[max_Idx];

        int[] cloned_Value = new int[ori_Value.length];
        for(int i = 1; i < ori_Value.length; i++)
            cloned_Value[i] = ori_Value[i];

        cloned_Value[max_Idx] = 0;

        if((14 - max_Idx) >= distribute_sum)
        {
            int pos = max_Idx + 1;
            while(distribute_sum > 0)
            {
                cloned_Value[pos] += 1;
                distribute_sum--;
                pos++;
            }
        }
        else
        {
            int pos = max_Idx + 1;
            while( pos <= 14)
            {
                cloned_Value[pos] += 1;
                distribute_sum--;
                pos++;
            }

            int div = distribute_sum / 14;
            int rem = distribute_sum % 14;
            //System.out.println(div + "\t" + rem);

            for(int i = 1; i <= 14; i++)
                cloned_Value[i] += div;
            for(int i = 1; i <= rem; i++)
                cloned_Value[i] += 1;
        }

        int sum = 0;
        for(int i = 1; i <= 14; i++)
        {
            if(cloned_Value[i]%2 == 0)
                sum += cloned_Value[i];
        }
        return sum;
    }
}

import java.io.*;
import java.util.*;

public class Solution{

    public static void main(String[] args) throws Exception{
        long[] A = in.readLA();
        long max = 0;
        for(int i = 0; i < A.length; i++){
            long cur = 0, add = A[i]/14, nz = A[i]%14;
            int j = i+1;
            long[] B = new long[14];
            for(int c = 0; c < 14 ; c++){
                long t = A[j%14];
                if(nz > 0){
                    t += 1;
                    nz--;
                }
                t += add;
                if(t % 2 == 0)
                    cur+=t;
                j++;
            }
            if(cur > max)   max = cur;
        }
        System.out.println(max);
    }

    static Inputer in;
    static {
        in = new Inputer();
    }

    static class Inputer{
        BufferedReader br;
        Inputer(){
            try{
                br = new BufferedReader(new InputStreamReader(System.in));
            }
            catch(Exception e){}
        }
        public int readInt() throws Exception{
            return Integer.parseInt(readLine());
        }
        public long readLong() throws Exception{
            return Long.parseLong(readLine());
        }
        public int[] readA(String delim) throws Exception{
            String[] s = readLine().split(delim);
            int[] A = new int[s.length];
            for(int i = 0; i < s.length; i++)
                A[i] = Integer.parseInt(s[i]);
            return A;
        }
        public int[] readA() throws Exception{
            String[] s = readLine().split("\\s+");
            int[] A = new int[s.length];
            for(int i = 0; i < s.length; i++)
                A[i] = Integer.parseInt(s[i]);
            return A;
        }
        public long[] readLA() throws Exception{
            String[] s = readLine().split("\\s+");
            long[] A = new long[s.length];
            for(int i = 0; i < s.length; i++)
                A[i] = Long.parseLong(s[i]);
            return A;
        }
        public String readLine() throws Exception{
            return br.readLine();
        }
        public int[] copyA(int[] A){
            int[] B = new int[A.length];
            for(int i= 0 ; i < A.length; i++)
                B[i] = A[i];
            return B;
        }
    }
    static void shuffle(int[] A){
        int n = A.length;
        Random rand = new Random();
        for(int t = 0; t < A.length; t++){
            int i1 = rand.nextInt(n);
            int i2 = rand.nextInt(n);
            int tmp = A[i1];
            A[i1] = A[i2];
            A[i2] = tmp;
        }
    }
}

import java.util.Scanner;

public class solution2 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n = 14;
		int max = 0;
		int[] ar = new int[14];
		for(int i=0;i<n;i++){
			ar[i]=in.nextInt();
		}
		for(int i = 0; i<n;i++){
			int temp[] = new int[14];
			for(int j=0;j<n;j++){
				temp[j]=ar[j];
			}
			int m = ar[i];
			if(m>0){
				int a = m/13;
				int r = m%13;
				for(int j = 0;j<n;j++){
					if(j!=i)
					temp[j]+=a;
				}
				int tempi = i;
				for(int j=0;j<r;j++){
					if(tempi==13){
						temp[0]+=1;
						tempi=0;
					}

					else if(tempi==12){
						temp[13]+=1;
						tempi=-1;
					}else{
						temp[tempi+1]+=1;
						tempi+=1;
					}
				}
				int tempm=0;
				for(int j=0;j<n;j++){

					if(temp[j]%2==0){
						tempm+=temp[j];
					}
				}
				if(max<tempm){
					max = tempm;}
			}

		}

		System.out.println(max);

	}

}

import java.io.*;
public class Mancala
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input[] = br.readLine().split(" ");
        int a[] = new int[input.length];
        int b[] = new int[input.length];
        for(int i=0;i<input.length;i++)
        {
            a[i] = Integer.parseInt(input[i]);
            b[i] = a[i];
        }
        int n = input.length;
        int max = 0,flag = 0;
        while(flag<n)
        {
            for(int i=0;i<n;i++)
                a[i] = b[i];
            if(a[flag] > 0)
                max = Math.max(max,answer(a,n,flag));
            flag++;
        }
        System.out.println(max);
    }
    static int answer(int a[],int n,int pos)
    {
        int val = a[pos]; // iterate over val
        int q = val/n;
        for(int i=0;i<n;i++)
            if(i == pos)
                a[i] = q;
            else
                a[i] += q;
        val %= n;
        // a[pos] = 0;
        if(pos + val + 1 <= n)
            for(int i = pos + 1;i<pos + val + 1;i++)
                a[i]++;
        else
        {
            for(int i = pos + 1;i<n;i++)
                a[i]++;
            for(int i=0;i<pos + val + 1 - n;i++)
                a[i]++;
        }
        /*for(int i=0;i<n;i++)
            System.out.print(a[i] + " ");
        System.out.println();*/
        int ct = 0;
        for(int i=0;i<n;i++)
            if(a[i] % 2 == 0)
                ct += a[i];
        return ct;
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Mancala {
public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int array[]=new int[14];

	int big=0,index=0;
	for(int i=0;i<14;i++){
		array[i]=sc.nextInt();
		if(array[i]>big){big=array[i];index=i;}
	}
	array[index]=0;
	int p=big/14;
	if(p>0){
	for(int i=0;i<array.length;i++){
		array[i]=array[i]+p;
	}}
	int rem=big-(14*p);
	if(rem>(array.length-index-1)){
		for(int i=index+1;i<array.length;i++){
			if(rem==0){break;}

			array[i]=array[i]+1;rem=rem-1;
		}
		for(int i=0;i<array.length;i++){
			if(rem==0){break;}

			array[i]=array[i]+1;rem=rem-1;
		}
	}else{
		for(int i=index+1;i<array.length;i++){
			if(rem==0){break;}
			array[i]=array[i]+1;rem=rem-1;
		}
	}
	long sum=0;
	for(int i=0;i<array.length;i++){
		if(array[i]%2==0){
			sum=sum+array[i];

		}
	}
	System.out.println(sum);
}
}

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Scanner input = new Scanner (System.in);

	     ArrayList<Long> A  = new ArrayList<Long>();
	     for (int i = 0 ; i < 14 ; i ++)
	     {

	    	 A.add(input.nextLong());
	     }

	     long MaxEven = (long) 0 ;
	     long tempMax =(long) 0 ;
	     Long Current = (long) 0 ;
	     int Aindex = 0 ;
	     long roundsAdded = 0 ;
	     ArrayList<Long> B = new ArrayList<Long>(A.size());

	     boolean changed = true  ;
	     for (int i =0 ; i < 14 ; i++)
	     {

   		 if (changed)
   		 {B = new ArrayList<Long> ();
	    	 for (int j =0 ; j < 14 ; j++)
		     {
	    		 B.add(A.get(j));

		     }
   		 }
	    	 Current = B.get(i);
	    	 if (Current != 0 )
	    	 {
	    		 long rounds =  (long) Math.floor(Current/14);

	    		 long remainder =  (long)( Current%14);
	    	 B.set(i, (long) 0);
	    	 if(rounds>0)
	    	 {

	    		 roundsAdded = rounds ;

	    	 }

   		     Aindex = i+1 ;
   		     if (roundsAdded > 0)
   		     {
   		     for (int j =0 ; j < 14 ; j++)
   		     {
   	    		 B.set(j, B.get(j)+roundsAdded);
   	    		 long X = B.get(j);
   	    		 if (X%2==0)
   	    		 {
   	    			 tempMax = tempMax + X;

   	    		 }
   		     }}
   			 while (remainder>0 )
   			 {
   				 if(Aindex == 14 )
   		    		{
   		    			Aindex = 0;
   		    		}

   				 long M = B.get(Aindex)+1 ;
   				 remainder--;
   				 if (M%2 ==0)
   				 {
   					 tempMax= tempMax+M;

   				 }
   				 Aindex++ ;
   			 }

   			 if (tempMax>MaxEven)
   			 {

   				 MaxEven = tempMax ;
   			 }
   			 tempMax = 0 ;
   			changed = true ;
	    	 }
	    	 else {

	    		 changed = false ;
	    	 }
	     }

	     System.out.print(MaxEven);

	}
	}

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Scanner input = new Scanner (System.in);

	     ArrayList<Long> A  = new ArrayList<Long>();
	     for (int i = 0 ; i < 14 ; i ++)
	     {

	    	 A.add(input.nextLong());
	     }

	     long MaxEven = (long) 0 ;
	     long tempMax =(long) 0 ;
	     Long Current = (long) 0 ;
	     int Aindex = 0 ;
	     long roundsAdded = 0 ;
	     ArrayList<Long> B = new ArrayList<Long>(A.size());

	     for (int i =0 ; i < 14 ; i++)
	     {

   		 B = new ArrayList<Long> ();
	    	 for (int j =0 ; j < 14 ; j++)
		     {
	    		 B.add(A.get(j));

		     }
	    	 Current = B.get(i);
	    	 if (Current != 0 )
	    	 {
	    		 long rounds =  (long) Math.floor(Current/14);

	    		 long remainder =  (long)( Current%14);
	    	 B.set(i, (long) 0);
	    	 if(rounds>0)
	    	 {

	    		 roundsAdded = rounds ;

	    	 }

   		     Aindex = i+1 ;
   		     if (roundsAdded > 0)
   		     {
   		     for (int j =0 ; j < 14 ; j++)
   		     {
   	    		 B.set(j, B.get(j)+roundsAdded);
   	    		 long X = B.get(j);
   	    		 if (X%2==0)
   	    		 {
   	    			 tempMax = tempMax + X;

   	    		 }
   		     }}
   			 while (remainder>0 )
   			 {
   				 if(Aindex == 14 )
   		    		{
   		    			Aindex = 0;
   		    		}

   				 long M = B.get(Aindex)+1 ;
   				 remainder--;
   				 if (M%2 ==0)
   				 {
   					 tempMax= tempMax+M;

   				 }
   				 Aindex++ ;
   			 }

   			 if (tempMax>MaxEven)
   			 {

   				 MaxEven = tempMax ;
   			 }
   			 tempMax = 0 ;
	    	 }

	     }

	     System.out.print(MaxEven);

	     }

	}

import java.util.*;
import static java.lang.Math.*;
import java.io.*;

public class SolutionB {

      public static void main(String args[])throws IOException{
              Scanner sc = new Scanner(System.in);
              long a[] = new long[14];
              for(int i = 0; i < 14; i++)
                     a[i] = sc.nextLong();
              long cpy[] = new long[14];
              long max = 0;
              for(int i = 0; i < 14; i++){
                     if(a[i] == 0)continue;
                     int score = 0;
                     long curr = a[i];
                     for(int j = 0; j < 14; j++)
                            cpy[j] = a[j];
                     cpy[i] = 0;
                     long amnt = curr / 14l;
                     for(int j = 0; j < 14; j++){
                            cpy[j] += amnt;
                     }
                     amnt = curr % 14;
                     for(int j = i + 1; j < i + 1 + amnt; j++){
                            cpy[j % 14]++;
                     }
                     for(int j = 0; j < 14; j++){
                            if(cpy[j] % 2 == 0)
                                   score += cpy[j];
                     }
                     max = Math.max(max, score);
              }
              System.out.println(max);
      }
}

import java.util.*;
public class Main {

	public static String sortString(String inputString)
    {
        // convert input string to char array
        char tempArray[] = inputString.toCharArray();

        // sort tempArray
        Arrays.sort(tempArray);

        // return new sorted string
        return new String(tempArray);
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int[] arr1=new int[14];
		for(int i=0;i<14;i++) {
			arr1[i]=s.nextInt();
		}
		int ans1=0;
		for(int i=0;i<14;i++) {
			int[] arr=new int[14];
			for(int j=0;j<14;j++) {
				arr[j]=arr1[j];
			}
			int ans=0;
			int temp=arr[i];
			int x=temp/14;
			for(int j=0;j<14;j++) {
				arr[j]=arr[j]+x;
			}
			int y=temp%14;
			int k=i+1;
			while(y!=0) {
				arr[(k)%14]++;
				k++;
				y--;
			}
			for(int j=0;j<14;j++) {
				if(arr[j]%2==0) {
					ans=ans+arr[j];
				}
			}
			if(ans>ans1) {
				ans1=ans;
			}
			//System.out.println(ans);

		}
		System.out.println(ans1);
	}

}

import java.util.*;
import java.io.*;
public class Mancala {
  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 void main(String[]args){
      FastReader input = new FastReader();
      int[] arr = new int[14];
      for(int i = 0;i < 14;i++){
        arr[i] = input.nextInt();
      }
      int record = -1;
      int sum = 0;
     for(int i = 0;i < 14;i++){
        int[] arr2 = new int[arr.length];
        for(int a = 0;a < arr.length;a++){
          arr2[a] = arr[a];
        }
     /*"   System.out.println("The array");
        for(int y : arr2){
          System.out.print(y + " ");
        }
        System.out.println(); */
     /*   for(int j = 0;j < arr2.length;j++){
          if(arr2[j] > 0 && j > record){
            record = j;
           // System.out.println("record = "+record);
            int p = arr2[j] / 14;
            int q = arr2[j] % 14;
            arr2[j] = 0;
            int key = j+1;
            if(key == 14) key = 0;
            int key2 = j+1;
            if(key2 == 14) key2 = 0;
            int count = 0;
            if(p > 0){
              while(count <= 14){
                arr2[key] = arr2[key] + p;
                key++;
                if(key == 14) key = 0;
                count++;
              }

            }
            if(q > 0){
              while(q > 0){
                arr2[key2++]++;
                q--;
                if(key2 == 14) key2 = 0;
              }
            }
            break;
          }
        } */
          for(int j = 0;j < arr2.length;j++){
            if(arr2[j] > 0 && j != record){
              record = j;
              int num = arr2[j];
              arr2[j] = 0;
              int p = j+1;
              if(p == 14) p = 0;
              while(num > 0){
                arr2[p++]++;
                if(p == 14) p = 0;
                num--;
              }
              break;
            }
          }
        int sum2 = 0;
        for(int t : arr2){
         // System.out.print(t + " ");
          if((t % 2) == 0){
            sum2 += t;
          }
        }
    //    System.out.println();
       if(sum2 > sum){
         sum = sum2;
       }
     }
     System.out.println(sum);

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(buf.readLine());

		long[] curr = new long[14];

		for(int i = 0; i < 14; i++) {

			curr[i] = Integer.parseInt(st.nextToken());

		}

		long max = 0;

		for(int i = 0; i < 14; i++) {

			long act = curr[i];

			long r = act / 14;

			long sol = (r % 2 == 0)? r : 0;

			int rest = (int)act % 14;

			for(int j = 1; j <= rest;j++ ) {
				if((curr[(i + j) % 14] + r + 1) % 2 == 0)sol += (curr[(i + j) % 14] + r + 1);
			}

			if(r > 0) {
				long val = 14 - rest - 1;

				for(int j = 1; j <= val;j++) {
					if((curr[(i + rest + j) % 14] + r) % 2 == 1)sol += (curr[(i + j) % 14] + r );
				}
			}

			max = Math.max(sol, max);

		}

		System.out.println(max);

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class macala {
public static void main(String[] args) {
	Scanner sc= new Scanner(System.in);
	int []elm =new int[14];
	for (int i = 0; i < elm.length; i++) {
		elm[i] = sc.nextInt();
	}
	int max = 0;
	for (int i = 0; i < elm.length; i++) {
		int [] tmp =Arrays.copyOf(elm, elm.length);
		int cur = tmp[i];
		tmp[i]= 0;
		cur-=cur/14;
		for (int j = 0; j < tmp.length; j++) {
			tmp[j]+=cur/14;
		}
		for (int j = i+1; j < tmp.length; j++) {
			if(cur==0)
				break;
			tmp[j]++;
			cur--;
		}
		for (int j = 0; j < i; j++) {
			if(cur==0)
				break;
			tmp[j]++;
			cur--;
		}
		int ansTmp =0;
		for (int j = 0; j < tmp.length; j++) {
			if(tmp[j]%2==0)
				ansTmp+=tmp[j];
		}
		max = Math.max(max, ansTmp);

	}
	System.out.println(max);
}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.ToIntFunction;
import java.util.function.ToLongFunction;

public class Solution {

    public static long[] toLongArrFromStringArr(String[] arr) {
        return Arrays.stream(arr).mapToLong(new ToLongFunction<String>() {
            @Override
            public long applyAsLong(String value) {
                return Long.parseLong(value);
            }
        }).toArray();
    }

    public static long solve(final long [] arr, final int MAX) {
        long result = 0;
        for (int i = 0; i < MAX; i++) {
            long[] tempArr = new long[MAX];
            System.arraycopy(arr, 0, tempArr, 0, MAX);
            long remaining = arr[i] % MAX;
            long extraCount = arr[i] / MAX;
            tempArr[i] = 0;
            int j = i + 1;
            while (remaining > 0) {
                j %= MAX;
                tempArr[j]++;
                j++;
                remaining--;
            }
            if (extraCount > 0) {
                for (int k = 0; k < MAX; k++) {
                    tempArr[k] += extraCount;
                }
            }
            int evenSum = 0;
            for (long k : tempArr) {
                if(k % 2 == 0) {
                    evenSum += k;
                }
            }
            result = Math.max(result, evenSum);
        }
        return result;
    }

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println(solve(toLongArrFromStringArr(br.readLine().split(" ")), 14));
    }
}

import java.util.*;

public class keks {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < 14; i++) {
            a.add(in.nextInt());
        }
        int max = 0;
        for (int i = 0; i<14; i++) {
            ArrayList<Integer> b = new ArrayList<>(a);
            int h = a.get(i);
            b.set(i, 0);
            if (h > 0) {
                int g = h/14;
                for (int k = 1; k<=14; k++) {
                    int index = (i+k)%14;
                    b.set(index, b.get(index) + g);
                }
                h %= 14;
                for (int k = 1; k<=h; k++) {
                    int index = (i+k)%14;
                    b.set(index, b.get(index) + 1);
                }
                int c = 0;
                for (int k = 0; k<14; k++) {
                    if (b.get(k) % 2 == 0) c += b.get(k);
                }
                if (c > max) max = c;
                for (int k = 0; k < 14; k++) {
                    System.out.print(b.get(k));
                }
                System.out.println();
            }
        }
        System.out.println(max);
    }
}

import java.util.Scanner;

public class B975 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] A = new int[14];
        for (int i=0; i<14; i++) {
            A[i] = in.nextInt();
        }
        long max = 0;
        for (int from=0; from<14; from++) {
            int a = A[from];
            long score = a/14;
            for (int i=1; i<14; i++) {
                int count = A[(from+i)%14] + (a+14-i)/14;
                if (count%2 == 0) {
                    score += count;
                }
            }
            max = Math.max(max, score);
        }
        System.out.println(max);
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemBMancala solver = new ProblemBMancala();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemBMancala {
        public static final int HOLES = 14;

        public void solve(int testNumber, InputReader reader, OutputWriter writer) {

            int holes[] = new int[HOLES];
            long tmpHoles[] = new long[HOLES];
            for (int i = 0; i < HOLES; i++) {
                holes[i] = reader.readInteger();
            }
            long max = 0;
            for (int i = 0; i < HOLES; i++) {
                copyArray(holes, tmpHoles);

                long stones = tmpHoles[i];
                if (stones == 0) continue;
                int indx = i + 1;
                while (stones > 0) {
                    if (indx == HOLES) {
                        indx = 0;
                    }
                    ++tmpHoles[indx];
                    --stones;
                    ++indx;
                }
                long sum = 0;
                for (int j = 0; j < HOLES; j++) {
                    if (tmpHoles[j] % 2 == 0) {
                        sum += tmpHoles[j];
                    }
                }
                if (sum > max) max = sum;
            }
            writer.print(max);
        }

        private void copyArray(int[] source, long[] target) {
            for (int i = 0; i < HOLES; i++) {
                target[i] = source[i];
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInteger() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

 import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.util.regex.*;
public class Myclass {

	public static void main(String[] args) {

		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		long a[]=new long[14];
		for(int i=0;i<14;i++)
			a[i]=in.nextLong();

		long max=Long.MIN_VALUE;

		for(int i=0;i<14;i++)
		{
			if(a[i]>0)
			{
			long[] b=new long [14];
			b=a.clone();

			long m=a[i]/14;
			long r=a[i]%14;
			for(int j=1;j<=14;j++)
			{
				if(r>0)
				{
					b[(i+j)%14]=b[(i+j)%14]+m+1;
					r--;
				}
				else
					b[(i+j)%14]=m+b[(i+j)%14];

			}
			b[i]=m;
			int sum=0;
			for(int j=0;j<14;j++)
			{
				if(b[j]%2==0)
				{
					sum+=b[j];
				}
			}
			if(sum>max)
				max=sum;
			}
		}
	pw.println(max);

		pw.flush();
		pw.close();
	}
		static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class cdfpc2a
{
	static void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }
    static int gcd(int a, int b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }
    static long power(long n,long m)
    {
    	if(m==0)
    		return 1;
    	long ans=1;
    	while(m>0)
    	{
    		ans=ans*n;
    		m--;
    	}
    	return ans;
    }
	static int binarySearch(ArrayList<Integer> arr, int x)
    {
        int l = 0, r = arr.size() - 1,m=l + (r - l) / 2;
        while (l <= r) {
            m = l + (r - l) / 2;
            if (arr.get(m) == x)
                return m;
            if (arr.get(m) < x)
                l = m + 1;
            else
                r = m - 1;
        }
        return (int)Math.max(l, m);
    }
	public static void main(String args[])throws Exception
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int t=1;//Integer.parseInt(br.readLine());
	    for(int i=1;i<=t;i++)
	    {
	        int n;
	        String s=br.readLine();
	        String ss[]=s.split(" ");
	        int arr[]=new int[14];
	        long sum=0,max=0;
	        for(int j=0;j<14;j++)
	        {
	        	arr[j]=Integer.parseInt(ss[j]);
	        }

	        for(int j=0;j<14;j++)
	        {
	        	sum=0;
	        	int temp=arr[j]%14;
	        	for(int k=j+1,l=0;l<14;l++,k++)
	        	{
	        		long tempo=arr[k%14]+(arr[j]/14);
	        		if(temp>0)
	        		{
	        			tempo++;
	        			temp--;
	        		}
	        		if(tempo%2==0)
	        			sum+=tempo;
	        	}
	        	if(sum>max)
	        		max=sum;
	        }
	        	System.out.println(max);
	    }
	}
}

import java.util.*;
public class Main {
	public static void main(String[] main){
		Scanner sc=new Scanner(System.in);
		int[] raw=new int[14];
		for(int i=0;i<14;i++){
			raw[i]=sc.nextInt();
		}
		int max=Integer.MIN_VALUE;
		int[] nec=new int[14];
		for(int t=0;t<14;t++){
			if(raw[t]==0) continue;
			for(int i=0;i<14;i++) nec[i]=raw[i];
			int num=raw[t];
			int cycle=num/14;
			for(int i=0;i<14;i++) nec[i]+=cycle;
			num=num%14;
			int indx=t+1,last=t+num;
			while(indx<=last){
				nec[indx%14]+=1;
				indx++;
			}
			int cnt=0;
			for(int i=0;i<14;i++){
				if(nec[i]%2==0){
					cnt+=nec[i];
				}
			}
			if(cnt>max) max=cnt;
		}
		System.out.println(max);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args)  throws Exception{
		Scanner sc = new Scanner (System.in);
		long [] a = new long [14];
		long max = 0;
		for(int i = 0 ; i< 14 ; i++)
			a[i] = sc.nextInt();

		for(int i = 0 ; i<14 ;i++)
		{
			long [] b = a.clone();
			long count = a[i];
			for(int j = (i+1)%14 ; count-->0 ;j= (j+1)%14)
			{

				b[j]++;
				long res = 0 ;
				for(int k  =0 ; k<14 ;k++)
					if(b[k] % 2  == 0)
						res+=b[k];

				max = Math.max(res, max);

			}

		}

		System.out.println(max);

	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;

public class Main {

    static long mod = 1000000007L;
    static FastScanner scanner;

    static int[] primes = {2,      3,      5,      7,     11,     13,     17,     19,     23,     29,
            31,     37,     41,     43,     47,     53,     59,     61,     67};
    static int[] masks = new int[71];
    static long[] results = new long[100010];
    static long[] pow2 = new long[100010];

    public static void main(String[] args) {
        scanner = new FastScanner();
        int n = 14;
        int[] a = scanner.nextIntArray(14);
        int res = 0;
        for (int i = 0; i < n; i++) {
            int[] b = Arrays.copyOf(a, a.length);
            int rs = a[i];
            if (rs == 0) continue;

            b[i] = 0;
            int rem = rs % 14;
            for (int j = 1; j <= rem; j++) {
                int pos = (i + j) % 14;
                b[pos] += 1;
            }

            int sum = 0;
            for (int x : b) {
                x += a[i] / 14;
                if (x % 2 == 0) sum += x;
            }
            res = Math.max(res, sum);
        }
        System.out.println(res);
    }

    static class Unit {
        long h;
        long d;
        int i;

        public Unit(long h, long d, int i) {
            this.h = h;
            this.d = d;
            this.i = i;
        }

        public long scoreForCast(int a) {
            long hh = h;
            for (int i = 0; i < a; i++) hh *= 2;
            return hh - d;
        }

        public long scoreForCastB() {
            return h - d;
        }
    }

    static class Segment implements Comparable<Segment> {
        int a;
        int b;
        int i;

        public Segment(int a, int b, int i) {
            this.a = a;
            this.b = b;
            this.i = i;
        }

        @Override
        public int compareTo(Segment o) {
            if (a == o.a) {
                return i - o.i;
            }
            return a - o.a;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException();
            }
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }

        int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) res[i] = nextInt();
            return res;
        }

        long[] nextLongArray(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) res[i] = nextLong();
            return res;
        }

        String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) res[i] = nextToken();
            return res;
        }
    }

    static class PrefixSums {
        long[] sums;

        public PrefixSums(long[] sums) {
            this.sums = sums;
        }

        public long sum(int fromInclusive, int toExclusive) {
            if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");
            return sums[toExclusive] - sums[fromInclusive];
        }

        public static PrefixSums of(int[] ar) {
            long[] sums = new long[ar.length + 1];
            for (int i = 1; i <= ar.length; i++) {
                sums[i] = sums[i - 1] + ar[i - 1];
            }
            return new PrefixSums(sums);
        }

        public static PrefixSums of(long[] ar) {
            long[] sums = new long[ar.length + 1];
            for (int i = 1; i <= ar.length; i++) {
                sums[i] = sums[i - 1] + ar[i - 1];
            }
            return new PrefixSums(sums);
        }
    }

    static class ADUtils {
        static void sort(int[] ar) {
            Random rnd = ThreadLocalRandom.current();
            for (int i = ar.length - 1; i > 0; i--)
            {
                int index = rnd.nextInt(i + 1);
                // Simple swap
                int a = ar[index];
                ar[index] = ar[i];
                ar[i] = a;
            }
            Arrays.sort(ar);
        }

        static void reverse(int[] arr) {
            int last = arr.length / 2;
            for (int i = 0; i < last; i++) {
                int tmp = arr[i];
                arr[i] = arr[arr.length - 1 - i];
                arr[arr.length - 1 - i] = tmp;
            }
        }

        static void sort(long[] ar) {
            Random rnd = ThreadLocalRandom.current();
            for (int i = ar.length - 1; i > 0; i--)
            {
                int index = rnd.nextInt(i + 1);
                // Simple swap
                long a = ar[index];
                ar[index] = ar[i];
                ar[i] = a;
            }
            Arrays.sort(ar);
        }
    }

    static class MathUtils {
        static long[] FIRST_PRIMES = {
                2,     3,      5,      7,     11,     13,     17,     19,     23,     29,
                31,     37,     41,     43,     47,     53,     59,     61,     67,     71,
                73,     79,     83,     89  ,   97 ,    101,    103,    107,    109,    113,
                127,    131,    137,    139,    149,    151,    157,    163,    167,    173,
                179,    181,    191,    193,    197,    199,    211,    223,    227,    229,
                233,    239,    241,    251,    257,    263,    269,    271,    277,    281,
                283,    293,    307,    311,    313,    317,    331,    337,    347,    349,
                353,    359,    367,    373,    379,    383,    389,    397,    401,    409,
                419,    421,    431,    433,    439,    443,    449,    457,    461,    463,
                467,    479,    487,    491,    499,    503,    509,    521,    523,    541,
                547,    557,    563,    569,    571,    577,    587,    593,    599,    601,
                607,    613,    617,    619,    631,    641,    643,    647,    653,    659,
                661,    673,    677,    683,    691,    701,    709,    719,    727,    733,
                739,    743,    751,    757,    761,    769,    773,    787,    797,    809,
                811,    821,    823,    827,    829,    839,    853,    857,    859,    863,
                877,    881,    883,    887,    907,    911,    919,    929,    937,    941,
                947,    953,    967,    971,    977,    983,    991,    997,   1009,   1013,
                1019,   1021,   1031,   1033,   1039,   1049,   1051};

        static long[] primes(int to) {
            long[] all = new long[to + 1];
            long[] primes = new long[to + 1];
            all[1] = 1;
            int primesLength = 0;
            for (int i = 2; i <= to; i ++) {
                if (all[i] == 0) {
                    primes[primesLength++] = i;
                    all[i] = i;
                }
                for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {
                    all[(int) (i * primes[j])] = primes[j];
                }
            }
            return Arrays.copyOf(primes, primesLength);
        }

        static long modpow(long b, long e, long m) {
            long result = 1;

            while (e > 0) {
                if ((e & 1) == 1) {
                    /* multiply in this bit's contribution while using modulus to keep
                     * result small */
                    result = (result * b) % m;
                }
                b = (b * b) % m;
                e >>= 1;
            }

            return result;
        }

        static long submod(long x, long y, long m) {
            return (x - y + m) % m;
        }
    }
}

//4 - 1 * 6 * 2 = 12

//5 - 4 * 6 * 2 = 48
//5(2) - 4 * 1 * 6 * 1 = 24

//3 - 2 * 2 = 4
//4(1) - 3 * 2 * 2 = 12
//4(2) - 3 * 2 = 6

//--------------------
// 7 3
// 4 - 1 * 6 * 6 = 36 C(3,3)
// 5 - 1 *            c(4,3)
//                    c(5,3)

// 1
// 1

// 8 10 16
// 8 1
//1 17 1 0 0 0 0 0 0 21 0 0 0 0

import java.util.Scanner;

public class A_AramicScript {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int diff=0;
        int n = sc.nextInt();
        boolean[][] block = new boolean[n][30];
        String inp=sc.nextLine();
        for(int i=0 ; i<n ; i++){
            inp = sc.next();

            boolean[] temp = new boolean[30];
            for(int p = 0 ; p<inp.length() ; p++){
                int pos = inp.charAt(p)-'a';
                temp[pos]=true;
            }

            boolean bing = false;

            for(int x = 0 ; x<diff ; x++){
                if(isSame(temp,block[x])){
                    bing=true;
                    break;
                }
            }
            if(!bing){

                block[diff] = temp;
                diff++;
            }

        }
        System.out.println(diff);

    }

    static boolean isSame(boolean[] a, boolean[] b){
        for(int i=0 ; i<30 ; i++)
            if(a[i]!=b[i])
                return false;
        return true;
    }
}

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner myScanner = new Scanner(System.in);
		int[] board = new int[14];

		for(int i = 0; i < 14; i++) {
			board[i] = myScanner.nextInt();
		}

		ArrayList<Integer> myList = new ArrayList<Integer>();

		for(int i = 0; i < 14; i++) {
			if(board[i] != 0) {
				int[] adder = new int[14];
				for(int j = 0; j < 14; j++) {
					adder[(i+j+1)%14] = board[(i+j+1)%14];
					adder[i] = 0;
					adder[(i+j+1)%14] += (board[i]>j)?(board[i]-j+13)/14:0;
				}
				int count = 0;
				for(int j = 0; j < 14; j++) {
					count += (adder[j]%2==0)?adder[j]:0;
				}
				//System.out.println(count);
				myList.add(count);
			}
		}

		int max = 0;
		for(int temp:myList) {
			if(temp>max) max = temp;
		}

		System.out.println(max);
	}

}

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int tab[]=new int[14];
		for(int i=0;i<14;i++) {
			tab[i]=sc.nextInt();
		}
		int max=tab[0];
		int imax=0;
		for(int i=0;i<14;i++) {
			if(tab[i]>max) imax=i;
		}
		int stones=tab[imax];
		int res=0;
		while(stones!=0) {
			if(imax<13) {
				imax++;
				tab[imax]++;
			}
			else {
				imax=0;
				tab[imax]++;
			}
			res=Math.max(res,calcule(tab));
			stones--;
		}
		System.out.println(res);
	}
	public static int calcule(int tab[]) {
		int res=0;
		for(int i=0;i<14;i++) {
			if(tab[i]%2==0) res+=tab[i];
		}
		return res;
	}
}

import java.util.*;

/*
_Манкала
*/
public class B975 {
    public static void main(String...args){
        int answer = 0;
        Scanner sc = new Scanner(System.in);
        int[] lunki = new int[14];

        for(int i = 0; i < 14; i++){
            int a = sc.nextInt();
            lunki[i] = a;
        }

        for(int i = 0; i < 14; i++){
            int amount = lunki[i];
            if(amount != 0){
                int amountOfI = putting(lunki,i,amount);
                if(amountOfI > answer)
                    answer = amountOfI;
            }
        }
        System.out.println(answer);
    }
    public static int putting(int []arr,int index,int amount){
        int lunki[] = new int[14];

        System.arraycopy(arr, 0, lunki, 0, 14);

        lunki[index] = 0;

        int amountToAll = amount / 14;
        int remainder = amount % 14;
        for(int i = 0; i < 14; i++){
            lunki[i] += amountToAll;
        }
        for(int i = index+1; i < 14 && remainder>0; i++){
            lunki[i] += 1;remainder--;
        }
        for(int i = 0; i < index && remainder>0; i++){
            lunki[i] += 1;remainder--;
        }
        int answer = collectEven(lunki);
        return answer;
    }

    public static int collectEven(int []lunki){
        int answer = 0;
        for(int i = 0; i < 14; i++)
            if(lunki[i]%2==0)
                answer+=lunki[i];
        return answer;
    }

    public static void print(int[]lunki){
        for(int i = 0; i < 14; i++){
            System.out.print(lunki[i]+" ");
        }
        System.out.println("");
    }
}