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.
"""
..::::::::::::..:::::..:::::..:::::..::::::::..::::::::..:::::..::
'########::::::::'###:::::::'########:::::'########::::'##::::'##:
 ##.... ##::::::'## ##:::::: ##.... ##::::... ##..::::: ##:::: ##:
 ##:::: ##:::::'##:. ##::::: ##:::: ##::::::: ##::::::: ##:::: ##:
 ########:::::'##:::. ##:::: ########:::::::: ##::::::: #########:
 ##.....:::::: #########:::: ##.. ##::::::::: ##::::::: ##.... ##:
 ##::::::::::: ##.... ##:::: ##::. ##:::::::: ##::::::: ##:::: ##:
 ##::::::::::: ##:::: ##:::: ##:::. ##::::::: ##::::::: ##:::: ##:
..::::::::::::..:::::..:::::..:::::..::::::::..::::::::..:::::..:: 

8___8______________________8___8____
___*8___8*____________________*8___8*___
__*88___88*__________________*88___88*__
_*888___888*________________*888___888*_
_*8888_8888*________________*8888_8888*_
__*8888888*__________________*8888888*__
___*88888*____________________*88888*___
____*888*_________7**7_________*888*____
____*88*_________*8888*_________*88*____
_____*88*_______88888888_______*88*_____
_8_____*8*_____8888888888_____*8*_____8_
__8*_____*8*__8_88888888_8__*8*_____*8__
____88*________8888888888________*88____
_8_____*8888*_8_88888888_8_*8888*_____8_
___88__________8888888888__________88___
_8_____*8888*_8_88888888_8_*8888*_____8_
___*8*_________8888888888_________*8*___
__8____*888*__8_88888888_8__*888*____8__
____88_________8888888888_________88____
_______*888*__8_88888888_8__*888*_______
_______________8888888888_______________
_______________*88888888*_______________
________________*888888*________________
_________________*8888*_________________
___________________*888_________________
_____________________*88________________
_____________6_________*88______________
___________*8____________*88____________
__________*88______________*8*__________
_________*8888*______________*8*________
_________*888*________________*8*_______
__________*88*________________*8*_______
___________*8*_______________*8*________
____________*8*_____________*8*_________
______________*8*_________*8*___________
_________________*<88888>*_____________
"""
#----------FASTIOSTART-----------#

from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192
class FastIO(IOBase):
	newlines = 0
	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None
	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()
	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n") + (not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()
	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode("ascii"))
		self.read = lambda: self.buffer.read().decode("ascii")
		self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
	sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop("end", "\n"))
	if kwargs.pop("flush", False):
		file.flush()
if sys.version_info[0] < 3:
	sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
	sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#----------FASTIOFINISH----------#

import collections,re,itertools,statistics,math
from collections import *
from itertools import * 
from statistics import *
from math import *
from re import *
mod=int(1e9+7)
imin=-2147483648;
imax=2147483647;
true=True
false=False
none=None
inp = lambda : input()
I   = lambda : int(inp())
M   = lambda : map(int,inp().split())
L   = lambda : list(M())
Yes = lambda : print("Yes")
No  = lambda : print("No")
YES = lambda : print("YES")
NO  = lambda : print("NO")
def IO():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
def true_yes(statement):
	return YES() if statement else NO()
def state(statement,one,two):
	print(one if statement else two)
def swap(a,b):
	a,b=b,a
def prec(a):
	return ("{0:.7f}".format(a))
def binary_search(arr,low,high,x):
	while (low <= high):
		mid=low+(high-low)//2;
		if(arr[mid]==x):
			return [mid,true]
		elif(arr[mid] > x):
			high=mid-1;
		else:
			low=mid-1;
	return [-1,false]

#----------UserCodeStart-----------#
 
def kabraji_ka_totka():
	#IO()
	a = L()
	def score(i):
	    b = a[i+1:] + a[0:i] + [0]
	    for j in range(14):
	        b[j] += a[i] // 14
	    for j in range(a[i] % 14):
	        b[j] += 1
	    return sum(x for x in b if x % 2 == 0)
	print(max(score(i) for i in range(14)))

#----------UserCodeFinish----------#

if __name__=="__main__":
	kabraji_ka_totka()
