Polycarp has a cat and his cat is a real gourmet! Dependent on a day of the week he eats certain type of food:  on Mondays, Thursdays and Sundays he eats fish food;  on Tuesdays and Saturdays he eats rabbit stew;  on other days of week he eats chicken stake. 

Polycarp plans to go on a trip and already packed his backpack. His backpack contains:  $a$ daily rations of fish food;  $b$ daily rations of rabbit stew;  $c$ daily rations of chicken stakes. 

Polycarp has to choose such day of the week to start his trip that his cat can eat without additional food purchases as long as possible. Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.


-----Input-----

The first line of the input contains three positive integers $a$, $b$ and $c$ ($1 \le a, b, c \le 7\cdot10^8$) — the number of daily rations of fish food, rabbit stew and chicken stakes in Polycarps backpack correspondingly.


-----Output-----

Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.


-----Examples-----
Input
2 1 1

Output
4

Input
3 2 2

Output
7

Input
1 100 1

Output
3

Input
30 20 10

Output
39



-----Note-----

In the first example the best day for start of the trip is Sunday. In this case, during Sunday and Monday the cat will eat fish food, during Tuesday — rabbit stew and during Wednesday — chicken stake. So, after four days of the trip all food will be eaten.

In the second example Polycarp can start his trip in any day of the week. In any case there are food supplies only for one week in Polycarps backpack.

In the third example Polycarp can start his trip in any day, excluding Wednesday, Saturday and Sunday. In this case, the cat will eat three different dishes in three days. Nevertheless that after three days of a trip there will be $99$ portions of rabbit stew in a backpack, can cannot eat anything in fourth day of a trip.

Difficulty: introductory

Starter code:

Solutions:
A, B, C = list(map(int, input().split()))

g = min(A//3,B//2,C//2)

A -= g*3
B -= g*2
C -= g*2

L = [0,0,1,2,0,2,1]
def calc(today, x):
    if x[L[today]] == 0:
        return 0
    y = [xx for xx in x]
    y[L[today]] -= 1
    return calc((today+1)%7, y) + 1

ma = 0
for i in range(7):
    ma = max(ma, calc(i, [A,B,C]))

print(ma+g*7)


def f(a, b, c):
    kek = [a, b, c]
    arr = [0, 0, 1, 2, 0, 2, 1] * 100
    ans = 0
    for i in range(7):
        tmp = kek + []
        j = i
        while tmp[arr[j]]:
            tmp[arr[j]] -= 1
            j += 1
        ans = max(ans, j - i)
    return ans

def main():
    a, b, c = map(int, input().split())
    d = min(a // 3, b >> 1, c >> 1)
    ans = 7 * d
    a -= 3 * d
    b -= d << 1
    c -= d << 1
    ans += f(a, b, c)
    print(ans)
    return 0

main()

A = list(map(int, input().split()))
X = [0, 1, 2, 0, 2, 1, 0]
a, b, c = A
res = min(min(a//3, b//2), c//2)
a -= res*3
b -= res*2
c -= res*2
res *= 7
A = [a, b, c]
maxc = -1
for i in range(0, 7):
	A0 = A[:]
	c = 0
	while True:
		if A0[X[i]] > 0:
			A0[X[i]] -= 1
			c += 1
			i = (i + 1) % 7
		else:
			break
	if c > maxc:
		maxc = c
print(res + maxc)

IN = input
rint = lambda: int(IN())
rmint = lambda: list(map(int, IN().split()))
rlist = lambda: list(rmint())

w = [0, 1, 2, 0, 2, 1, 0]
h = rlist()
ans = 0


def g(x):
    p = w[x:]
    a = h[:]
    v = 0
    for f in p:
        if not a[f]: return v
        a[f] -= 1
        v += 1
    u = min([a[0] // 3, a[1] // 2, a[2] // 2])
    a[0] -= u*3
    a[1] -= u*2
    a[2] -= u*2
    v += u * 7
    for f in w:
        if not a[f]: return v
        a[f] -= 1
        v += 1
    return v


for i in range(7): ans = max(ans, g(i))
print(ans)


a, b, c = list(map(int, input().split()))
cost = [0, 1, 2, 0, 2, 1, 0]
dcost = [3, 2, 2]
weeks = min(a // 3, b // 2, c // 2)
left = [a - 3 * weeks, b - 2 * weeks, c - 2 * weeks]
cost = cost + cost
maxdays = 0
for i in range(7):
    l = left[:]
    days = 0
    for j in range(i, i + 7):
        if l[cost[j]] == 0:
            break
        days += 1
        l[cost[j]] -= 1
    maxdays = max(maxdays, days)
print(weeks * 7 + maxdays)


a = list(map(int, input().split()))
wek = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= wek * 3
a[1] -= wek * 2
a[2] -= wek * 2
A = [0, 0, 1, 2, 0, 2, 1]
A = A + A
mx = 0
for i in range(7):
    ans = 0
    cur = i
    b = a.copy()
    while b[A[cur]]:
        ans += 1
        b[A[cur]] -= 1
        cur += 1
    mx = max(mx, ans)
print(mx + wek * 7)


import copy
l=list(map(int,input().split()))
ans=min(l[0]//3,l[1]//2,l[2]//2)
l[0]-=ans*3
l[1]-=ans*2
l[2]-=ans*2
ans*=7
l1=[0,1,2,0,2,1,0]
l1+=l1
v=ans
for i in range(7) :
    k=0
    L=copy.copy(l)
    for j in range(i,i+7) :
        if L[l1[j]]<=0 :
            break
        L[l1[j]]-=1
        k+=1
    
    ans=max(ans,v+k)
print(ans)
    
    


E = [0, 1, 2, 0, 2, 1, 0]
a = list(map(int, input().split()))
ans = 0
for d in range(7):
  e = E[d:] + E[:d]
  b = a.copy()
  pas = min(a[0] // 3, a[1] // 2, a[2] // 2)
  b[0] -= pas * 3
  b[1] -= pas * 2
  b[2] -= pas * 2
  it = 0
  while b[e[it]]:
    b[e[it]] -= 1
    it += 1
  ans = max(ans, pas * 7 + it)
print(ans)


a, b, c = list(map(int, input().split()))

a_week = a // 3
b_week = b // 2
c_week = c // 2

week = min(a_week, b_week, c_week)

a -= week * 3
b -= week * 2
c -= week * 2

# Do simulation
max_day = 0

for i in range(7):

	aa = a
	bb = b
	cc = c
	count = 0

	for j in range(7):

		day = (i + j) % 7

		if day == 0 or day == 3 or day == 6:
			aa -= 1
		elif day == 1 or day == 5:
			bb -= 1
		else:
			cc -= 1

		if aa < 0 or bb < 0 or cc < 0:
			break
		count += 1

	if count > max_day:
		max_day = count

result = week * 7 + max_day
print(result)


a,b,c = list(map(int,input().split()))
week = [0,1,2,0,2,1,0]
nums = [3,2,2]
num = min(min(a // nums[0],b // nums[1]), c // nums[2])
num2 = [a - nums[0] * num,b - nums[1] * num,c - nums[2] * num]
ans = 0
for j in range(7):
    num3 = [num2[0],num2[1],num2[2]]
    i = j
    temp = num * 7
    while True:
        if num3[week[i]] == 0:
            break
        num3[week[i]] -= 1
        temp += 1
        i += 1
        i %= 7
    ans = max(temp,ans)
print(ans)
    


a, b, c = list(map(int, input().split()))
weeks = min(a//3, b//2, c//2)
a -= weeks * 3
b -= weeks * 2
c -= weeks * 2

days = ["f", "r", "c", "f", "c", "r", "f"]
ans = 0

for i in range(7):
    day = i
    anstemp = 0
    A = a
    B = b
    C = c
    for j in range(50):
        if days[day] == "f":
            if A > 0:
                A -= 1
                day += 1
                anstemp += 1
            else:
                break
        elif days[day] == "r":
            if B > 0:
                B -= 1
                day += 1
                anstemp += 1
            else:
                break
        else:
            if C > 0:
                C -= 1
                day += 1
                anstemp += 1
        if day == 7:
            day = 0
    ans = max(anstemp, ans)

ans += weeks * 7
print(ans)


a, b, c = map(int, input().split())
cnt = 0
cnt += min(a // 3, b // 2, c // 2)
a -= 3 * cnt
b -= 2 * cnt
c -= 2 * cnt
sas = 0
Q = [0, 1, 2, 0, 2, 1, 0]
for first_day in range(7):
    heh = 0
    aa, bb, cc = a, b, c
    W = [a, b, c]
    while W[Q[first_day]]:
        if Q[first_day] == 0:
            aa -= 1
        elif Q[first_day] == 1:
            bb -= 1
        else:
            cc -= 1
        first_day += 1
        heh += 1
        first_day %= 7
        W = [aa, bb, cc]
    sas = max(sas, heh)
print(sas + 7 * cnt)

d = [0, 1, 2, 0, 2, 1, 0]

a, b, c = [int(item) for item in input().split()]

ans = -float("inf")

k = min(a // 3, b // 2, c // 2)
g = k * 7
a -= 3 * k
b -= 2 * k
c -= 2 * k

for s in range(7):
    days = 0
    ca, cb, cc = a, b, c
    for day in range(s, s + 7):
        if d[day % 7] == 0:
            if ca == 0:
                break
            ca -= 1
        elif d[day % 7] == 1:
            if cb == 0:
                break
            cb -= 1
        else:
            if cc == 0:
                break
            cc -= 1
        days += 1

    ans = max(ans, days)


print(ans + g)


a, b, c = list(map(int, input().split()))
d = min(a // 3, b // 2, c // 2)
p = [0] * 3
p[0] = a - (3 * d) if d > 0 else a
p[1] = b - (2 * d) if d > 0 else b
p[2] = c - (2 * d) if d > 0 else c
r = [0,1,2,0,2,1,0] * 2
#print(d)
#print(p)
i = 0
j = 0
ans = 0
while i < 14 and j < 14:
    if p[r[j]]:
        p[r[j]] -= 1
        j += 1
    elif i != j:
        p[r[i]] += 1
        i += 1
    else:
        i += 1
        j += 1
    ans = max(ans, j - i)

print(d * 7 + ans)


import sys
input = sys.stdin.readline

a,b,c=list(map(int,input().split()))

aw=a//3
bw=b//2
cw=c//2

MIN=min(aw,bw,cw)

ANS=MIN*7

a-=MIN*3
b-=MIN*2
c-=MIN*2
SCOREMAX=0

for start in range(7):
    ax=a
    bx=b
    cx=c
    SCORE=0
    R=[0,1,2,0,2,1,0][start:]+[0,1,2,0,2,1,0][:start]

    for k in R*100:
        if k==0:
            if ax==0:
                break
            else:
                ax-=1
        if k==1:
            if bx==0:
                break
            else:
                bx-=1

        if k==2:
            if cx==0:
                break
            else:
                cx-=1

        SCORE+=1

    SCOREMAX=max(SCOREMAX,SCORE)

print(ANS+SCOREMAX)



a, b, c = list(map(int, input().split()))

a1, b1, c1 = a, b, c

k = min(a // 3, b // 2, c // 2)


a -= 3 * k
b -= 2 * k
c -= 2 * k

aa = [1, 2, 3, 1, 3, 2, 1]

aa += aa[:]

mx = 0
ind = 1

for i in range(7):
	var = [0, a, b, c]
	kol = 0
	
	for j in range(i, 7 + 7):
		if var[aa[j]] == 0:
			break
		var[aa[j]] -= 1
		kol += 1
	
	if kol > mx:
		mx = kol
		ind = i + 1


print(k * 7 + mx)


a, b, c = [int(elem) for elem in input().split()]

num_weeks = min(a // 3, b // 2, c // 2)
a -= 3 * num_weeks
b -= 2 * num_weeks
c -= 2 * num_weeks

# rest_rations = [a, b, c]
max_num_additional_days = 0

what_to_eat = [0, 0, 1, 2, 0, 2, 1]
for start in range(7):
    rest_rations = [a, b, c]
    num_additional_days = 0
    for i in range(start, start + 7):
        day = i % 7
        food_to_eat_today = what_to_eat[day]
        if rest_rations[food_to_eat_today] == 0:
            break
        rest_rations[food_to_eat_today] -= 1
        num_additional_days += 1
    max_num_additional_days = max(max_num_additional_days, num_additional_days)

print(max_num_additional_days + num_weeks * 7)


import collections

def calc(day,a,b,c):
    ret=0
    while True:
        if a>300000000 and b>200000000 and c>200000000:
            a-=300000000
            b-=200000000
            c-=200000000
            ret+=700000000
        elif a>3000000 and b>2000000 and c>2000000:
            a-=3000000
            b-=2000000
            c-=2000000
            ret+=7000000
        elif a>30000 and b>20000 and c>20000:
            a-=30000
            b-=20000
            c-=20000
            ret+=70000
        elif a>300 and b>200 and c>200:
            a-=300
            b-=200
            c-=200
            ret+=700
        elif a>3 and b>2 and c>2:
            a-=3
            b-=2
            c-=2
            ret+=7
        else:
            break

    while True:
        # 0=Monday
        if day==0 or day==3 or day==6:
            a-=1
            if a<0: return ret
        elif day==1 or day==5:
            b-=1
            if b<0: return ret
        elif day==2 or day==4:
            c-=1
            if c<0: return ret
        ret+=1
        day=(day+1)%7

def solve():
    a,b,c=list(map(int,input().split()))
    ans=0
    for i in range(7):
        ans=max(ans,calc(i,a,b,c))
    return ans

print(solve())


f = [0, 1, 2, 0, 2, 1, 0]
l = [int(i) for i in input().split()]
mn = min([l[i] // f.count(i) for i in range(3)])
l = [l[i] - mn * f.count(i) for i in range(3)]

mx = 0
for i in range(7):
    tmp = l.copy()
    j = 0
    while tmp[f[(i + j) % 7]] > 0:
        tmp[f[(i + j) % 7]] -= 1
        j += 1
    if j > mx:
        mx = j
print(mn * 7 + mx)


nums = [int(i) for i in input().split()]
a, b, c = nums[0], nums[1], nums[2]

mode = 'abcacba'

min_weeks = 10 ** 9

min_weeks = min(min_weeks, a // 3)
min_weeks = min(min_weeks, b // 2)
min_weeks = min(min_weeks, c // 2)

a, b, c = a - min_weeks * 3, b - min_weeks * 2, c - min_weeks * 2

max_days = 0
for i in range(7):
    j = 0
    left_a, left_b, left_c = a, b, c

    while True:
        eat = mode[(i + j) % 7]
        
        if eat == 'a':
            if left_a == 0:
                break
            left_a -= 1
        elif eat == 'b':
            if left_b == 0:
                break
            left_b -= 1
        else:
            if left_c == 0:
                break
            left_c -= 1
        
        j += 1
    
    max_days = max(max_days, j)

print(min_weeks * 7 + max_days)


def mp():
    return list(map(int, input().split()))

a, b, c = mp()

k = min(a // 3, b // 2, c // 2)
a -= 3 * k
b -= 2 * k
c -= 2 * k

m = 0
for i in range(7):
    d = i
    cnt = 0
    x, y, z = a, b, c
    while not(x < 0 or y < 0 or z < 0):
        if d in [0, 3, 6]:
            x -= 1
        elif d in [1, 5]:
            y -= 1
        else:
            z -= 1
        d = (d + 1) % 7
        cnt += 1
    cnt -= 1
    #print(cnt)
    m = max(m, cnt)
    cnt = 0
    
print(7 * k + m)


a, b, c = map(int, input().split())
sa, sb, sc = a // 3, b // 2, c // 2
m = min(sa, sb, sc)
pa, pb, pc = a - 3 * m, b - 2 * m, c - 2 * m
d = [1,2,3,1,3,2,1,1,2,3,1,3,2,1,1,2,3,1,3,2,1]
mr = 0
for i in range(7):
	a,b,c = pa, pb, pc
	k = i
	r = 0
	while not -1 in [a,b,c]:
		if d[k] == 1:
			a -= 1
		elif d[k] == 2:
			b -= 1
		else:
			c -= 1
		k += 1
		r += 1
	mr = max(r, mr)
print(7 * m + mr - 1)

a,b,c=list(map(int,input().split()))
s={0:0,3:0,6:0,1:1,5:1,2:2,4:2}
oo=0
aa,bb,cc=a,b,c
if True:
    kk=(a+b+c)//7
    if min([a//3,b//2,c//2])==a//3:
        nn=a//3
        a=a%3
        b-=nn*2
        c-=nn*2
    elif min([a//3,b//2,c//2])==b//2:
        nn=b//2
        b=b%2
        a-=nn*3
        c-=nn*2
    elif min([a//3,b//2,c//2])==c//2:
        nn=c//2
        c=c%2
        a-=nn*3
        b-=nn*2
#print(a,b,c)
st=(aa+bb+cc)-(a+b+c)
for i in range(7):
    mm=[a,b,c]
    ind=i
    while True:
        ind+=1
        ind=ind%7
        if mm[s[ind]]==0:
            break
        else:
            mm[s[ind]]-=1
    oo=max(oo,(a+b+c)-sum(mm))
print(oo+st)
    


a, b, c = (int(i) for i in input().split())
j = min(a // 3, min(b // 2, c // 2))
a = a - j * 3
b = b - j * 2
c = c - j * 2
G = [1, 2, 3, 1, 3, 2, 1]
ma = 0
for i in range(7):
    a1, b1, c1 = a, b, c
    s = 0
    for h in range(7):
        if G[h] == 1:
            if a1:
                a1 -= 1
            else:
                break
        elif G[h] == 2:
            if b1:
                b1 -= 1
            else:
                break
        else:
            if c1:
                c1 -= 1
            else:
                break
        s += 1
    if s > ma:
        ma = s
    v = G[0]
    del(G[0])
    G.append(v)
    #print(G)
print(j * 7 + ma)


a, b, c = list(map(int,input().split()))
chuj = ['a', 'b', 'c', 'a', 'c', 'b', 'a', 'a', 'b', 'c', 'a', 'c', 'b', 'a']
p = min(a // 3, b // 2, c // 2)
a = a - p * 3
b = b - p * 2
c = c - p * 2
wyn = 7 * p
res = 0
for i in range(7):
	pom = 0
	aa = a
	bb = b
	cc = c
	for j in range(7):
		if chuj[i + j] == "a":
			aa -= 1
		if chuj[i + j] == "b":
			bb -= 1
		if chuj[i + j] == "c":
			cc -= 1
		if aa < 0 or bb < 0 or cc < 0:
			res = max(pom,res)
			break
		pom += 1
print(res+wyn)