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

<image>

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

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

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

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

Input

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

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

Output

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

Examples

Input

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


Output

4


Input

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


Output

8

Note

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

/**
 * Created by hapsi on 11.10.2016.
 */
public class Main {
    private static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;
        public FastScanner(InputStream inputStream){
            br = new BufferedReader(new InputStreamReader(inputStream));
        }
        public String next() {
            while (st == null || !st.hasMoreTokens()){
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException ignored){}
            }
            return st.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    private static int binarySearch(int []a, int l, int r, int x){
        if (l >= r) return -1;
        int m = (l + r) / 2;
        if (a[m] > x || (a[m] == x && m > 0 && a[m-1] == x))
            return binarySearch(a, l, m, x);
        else if (a[m] < x)
            return binarySearch(a, m + 1, r, x);
        return m;
    }

    private static int nextSearch(int []a, int l, int r, int x){
        if (l >= r) return l;
        int m = (l + r) / 2;
        if (a[m] > x)
            return nextSearch(a, l, m, x);
        else if (a[m] < x || (m < a.length - 1 && a[m+1] == x))
            return nextSearch(a, m + 1, r, x);
        return m + 1;
    }

    private static int nearestSearch(int []a, int l, int r, int x) {
        if (l >= r) {
            if (a.length == 1) {
                return 0;
            }
            else if (l >= a.length) {
                return a.length - 1;
            }
            else if (l-1 >= 0) {
                int d1 = Math.abs(a[l-1] - x);
                int d2 = Math.abs(a[l] - x);
                if (d1 <= d2) {
                    return l-1;
                }
                return l;
            }
            else {
                return l;
            }
        }
        int m = (l + r) / 2;
        if (a[m] > x || (a[m] == x && m > 0 && a[m-1] == x)) {
            return nearestSearch(a, l, m, x);
        }
        else if (a[m] < x) {
            return nearestSearch(a, m + 1, r, x);
        }
        return m;
    }

    private static int compareString(String a, String b){
        if(a.length() > b.length()){
            return 1;
        }
        else if(a.length() < b.length()){
            return -1;
        }
        for(int i=0;i<a.length();i++){
            if(a.charAt(i) > b.charAt(i)){
                return 1;
            }
            else if(a.charAt(i) < b.charAt(i)){
                return -1;
            }
        }
        return 0;
    }

    public static void main(String args[]){
        FastScanner scanner = new FastScanner(System.in);
        PrintWriter printer = new PrintWriter(System.out);
        long a[] = new long[14];
        for (int i = 0; i < a.length; i++) {
            a[i] = scanner.nextLong();
        }
        long ans = 0;
        for (int i = 0; i < a.length; i++) {
            //printer.println(i + " " + f(a, i));
            ans = Math.max(ans, f(a, i));
        }
        printer.println(ans);
        printer.close();
    }

    private static long f(long a[], int i){
        long t[] = a.clone();
        long k = t[i];
        t[i] = 0;
        i++;
        for (int l = 0; l < a.length; l++) {
            if(i==a.length) i = 0;
            if(k==0){
                break;
            }
            long d = k/t.length;
            if(k%t.length != 0) d++;
            t[i]+=d;
            k--;
            i++;
        }
        //for (int j = 0; j < t.length; j++) {
        //    System.out.print(t[j]+" ");
        //}
        //System.out.println();
        k=0;
        for (int j = 0; j < t.length; j++) {
            if(t[j] % 2 == 0) k+=t[j];
        }
        return k;
    }
    //0 0 0 0 0 0 0 0 0 14 0 0 0 0
    //0 0 0 0 0 0 0 0 0 16 0 0 0 0
    //0 0 0 0 0 0 0 0 0 17 0 0 0 0
}

