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: MEDIUM
Tags: Mathematics

Implementation

Starter code:

Solutions:
(a, b, c) = map(int, input().split())
Q = [a // 3, b // 2, c // 2]
q = min(Q)
R = [a - 3 * q, b - 2 * q, c - 2 * q]
s = [0, 1, 2, 0, 2, 1, 0]
s *= 2
import copy
ans = -1
for i in range(7):
	temp = [a - 3 * q, b - 2 * q, c - 2 * q]
	for j in range(i, i + 7):
		if temp[s[j]] == 0:
			break
		else:
			temp[s[j]] -= 1
	ans = max(7 * q + j - i, ans)
print(ans)


(a, b, c) = [int(x) for x in input().split()]
w = min(a // 3, b // 2, c // 2)
r = [a - 3 * w, b - 2 * w, c - 2 * w]
m = [0, 0, 1, 2, 0, 2, 1]
hi = 0
for i in range(7):
	rr = r[:]
	d = 0
	while rr[m[(i + d) % 7]] > 0:
		rr[m[(i + d) % 7]] = rr[m[(i + d) % 7]] - 1
		d = d + 1
	hi = max(hi, d)
print(7 * w + hi)


(a, b, c) = map(int, input().split())
(z, z1, z2) = (a // 3, b // 2, c // 2)
k = min(z, z1, z2)
ans = 7 * k
a -= 3 * k
b -= 2 * k
c -= 2 * k
d = [0, 1, 2, 0, 2, 1, 0]
ma = 0
for i in range(7):
	k = [a, b, c]
	j = i
	while k[d[j % 7]]:
		k[d[j % 7]] -= 1
		j += 1
	ma = max(ma, j - i)
print(ans + ma)


(a, b, c) = map(int, input().split())
a1 = a // 3
b1 = b // 2
c1 = c // 2
ans = min(a1, b1, c1)
a -= ans * 3
b -= ans * 2
c -= ans * 2
if a == 0:
	if b >= 1:
		if c >= 1:
			print(ans * 7 + 2)
		else:
			print(ans * 7 + 1)
	elif c >= 1:
		print(ans * 7 + 1)
	else:
		print(ans * 7)
elif b == 0:
	if c >= 2:
		print(ans * 7 + 3)
	else:
		print(ans * 7 + 2)
elif c == 0:
	if a == 1:
		print(ans * 7 + 2)
	elif b == 1:
		print(ans * 7 + 3)
	else:
		print(ans * 7 + 4)
elif a == 1:
	if b == 1:
		if c == 1:
			print(ans * 7 + 3)
		else:
			print(ans * 7 + 4)
	elif c == 1:
		print(ans * 7 + 3)
	else:
		print(ans * 7 + 5)
elif a == 2:
	if b >= 2:
		if c >= 2:
			print(ans * 7 + 6)
		elif c == 1:
			print(ans * 7 + 5)
	elif b == 1:
		if c >= 1:
			print(ans * 7 + 4)
		else:
			print(ans * 7 + 3)
elif b == 1:
	if c >= 2:
		print(ans * 7 + 6)
	elif c == 1:
		print(ans * 7 + 6)
elif c == 1:
	print(ans * 7 + 6)


meal = [0, 1, 2, 0, 2, 1, 0]
a = [0] * 3
b = [0] * 3
(a[0], a[1], a[2]) = map(int, input().split())
ans = 0
for start in range(len(meal)):
	(l, r) = (0, int(1e+18))
	while r - l > 1:
		m = int((r + l) / 2)
		c = int(m / len(meal))
		(b[0], b[1], b[2]) = (meal.count(0) * c, meal.count(1) * c, meal.count(2) * c)
		for j in range(m % len(meal)):
			i = (start + j) % len(meal)
			b[meal[i]] += 1
		check = True
		for i in range(3):
			if b[i] > a[i]:
				check = False
		if check:
			l = m
		else:
			r = m
	ans = max(ans, l)
print(ans)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(x, y, z) = mp()
k = min(x // 3, y // 2, z // 2)
ans = 7 * k
x -= 3 * k
y -= 2 * k
z -= 2 * k
l = [x, y, z]
mx = ans
week = [0, 0, 1, 2, 0, 2, 1]
for i in range(7):
	ml = l.copy()
	j = 0
	while 1:
		ind = week[(i + j) % 7]
		if ml[ind]:
			ml[ind] -= 1
		else:
			break
		j += 1
	mx = max(ans + j, mx)
print(mx)


(a, b, c) = map(int, input().split())
cycles = min(a // 3, b // 2, c // 2)
a -= cycles * 3
b -= cycles * 2
c -= cycles * 2
res = 0
stew = [0, 1, 2, 0, 2, 1, 0]
for i in range(7):
	sum = 0
	na = a
	nb = b
	nc = c
	for j in range(7):
		s = stew[(i + j) % 7]
		if s == 0:
			na -= 1
		elif s == 1:
			nb -= 1
		else:
			nc -= 1
		if na > -1 and nb > -1 and (nc > -1):
			sum += 1
		else:
			res = max(res, sum)
			break
print(cycles * 7 + res)


import os
import sys
from io import BytesIO, IOBase

def main():
	(a, b, c) = map(int, input().split(' '))
	minw = min(a // 3, b // 2, c // 2)
	a = a - minw * 3
	b = b - minw * 2
	c = c - minw * 2
	ans = minw * 7
	maxwala = 0
	for x in range(7):
		(ac, bc, cc) = (a, b, c)
		start = x
		cnt = 0
		while True:
			if start == 1 or start == 4 or start == 0:
				if ac > 0:
					ac -= 1
					cnt += 1
					start = (start + 1) % 7
				else:
					break
			elif start == 2 or start == 6:
				if bc > 0:
					bc -= 1
					cnt += 1
					start = (start + 1) % 7
				else:
					break
			elif cc > 0:
				cc -= 1
				cnt += 1
				start = (start + 1) % 7
			else:
				break
		maxwala = max(maxwala, cnt)
	print(maxwala + ans)
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


foods = list(map(int, input().split()))
types = [0, 1, 2, 0, 2, 1, 0]
max_days = 0
for day in range(7):
	days = 0
	foods2 = foods[:]
	for i in range(day, 7):
		if foods2[types[i]] == 0:
			break
		foods2[types[i]] -= 1
		days += 1
	weeks = min(foods2[0] // 3, foods2[1] // 2, foods2[2] // 2)
	days += 7 * weeks
	foods2[0] -= 3 * weeks
	foods2[1] -= 2 * weeks
	foods2[2] -= 2 * weeks
	for i in range(7):
		if foods2[types[i]] == 0:
			break
		foods2[types[i]] -= 1
		days += 1
	max_days = max(max_days, days)
print(max_days)


(a, b, c) = map(int, input().split())
w = min(min(a // 3, b // 2), c // 2)
ans = w * 7
if w > 0:
	a -= 3 * w
	b -= 2 * w
	c -= 2 * w
tmp = 0
(nc, nb, na) = (c, b, a)
s = 'pkopokp'
for start in range(len(s)):
	cur = 0
	newc = c
	newb = b
	newa = a
	for j in range(10000):
		pos = start + j
		pos %= len(s)
		if s[pos] == 'p':
			newa -= 1
			if newa < 0:
				break
			cur += 1
		if s[pos] == 'k':
			newb -= 1
			if newb < 0:
				break
			cur += 1
		if s[pos] == 'o':
			newc -= 1
			if newc < 0:
				break
			cur += 1
	tmp = max(tmp, cur)
print(ans + tmp)


from sys import stdin
A = list(map(int, stdin.readline().split()))
B = A[0]
C = A[1]
D = A[2]
BBB = B // 3
CCC = C // 2
DDD = D // 2
E = min(BBB, min(CCC, DDD))
B -= 3 * E
C -= 2 * E
D -= 2 * E
test = ['B', 'C', 'D', 'B', 'D', 'C', 'B', 'B', 'C', 'D', 'B', 'D', 'C', 'B']
MAX = 0
for t in range(0, 7):
	count = 0
	BB = B
	CC = C
	DD = D
	for u in range(0, 7):
		if test[t + u] == 'B':
			BB -= 1
			if BB >= 0:
				count += 1
			else:
				MAX = max(MAX, count)
				break
		if test[t + u] == 'C':
			CC -= 1
			if CC >= 0:
				count += 1
			else:
				MAX = max(MAX, count)
				break
		if test[t + u] == 'D':
			DD -= 1
			if DD >= 0:
				count += 1
			else:
				MAX = max(MAX, count)
				break
print(7 * E + MAX)


foods = [int(x) for x in input().split()]
eat = [0, 1, 2, 0, 2, 1, 0]
fullWeeks = min(foods[0] // 3, foods[1] // 2, foods[2] // 2)
foods[0] -= fullWeeks * 3
foods[1] -= fullWeeks * 2
foods[2] -= fullWeeks * 2
restDays = 0
for i in range(7):
	eattenRest = [0, 0, 0]
	now = i
	tmpRestDays = -1
	while foods[0] >= eattenRest[0] and foods[1] >= eattenRest[1] and (foods[2] >= eattenRest[2]):
		eattenRest[eat[now]] += 1
		now = (now + 1) % 7
		tmpRestDays += 1
	restDays = max(tmpRestDays, restDays)
print(fullWeeks * 7 + restDays)


(a, b, c) = list(map(int, input().split()))
(totalWeeksA, totalWeeksB, totalWeeksC) = (a // 3, b // 2, c // 2)
atleast = min(totalWeeksA, totalWeeksB, totalWeeksC)
days = 7 * atleast
left = [a - 3 * atleast, b - 2 * atleast, c - 2 * atleast]
order = [0, 1, 2, 0, 2, 1, 0]
val = 0
for i in range(7):
	c = 0
	j = 0
	testCopy = [i for i in left]
	while True:
		if testCopy[order[(i + j) % 7]] == 0:
			break
		testCopy[order[(i + j) % 7]] -= 1
		c += 1
		j += 1
	val = max(c, val)
days += val
print(days)


(a, b, c) = [int(elm) for elm in input().split(' ')]
min_week = min([a // 3, b // 2, c // 2])
day_num = min_week * 7
a -= 3 * min_week
b -= 2 * min_week
c -= 2 * min_week
foods = [0, 1, 2, 0, 2, 1, 0]
days = []
hozon = [a, b, c]
for i in range(7):
	[a, b, c] = hozon.copy()
	cur_day = 0
	for j in range(7):
		id = (i + j) % 7
		if foods[id] == 0:
			if a == 0:
				break
			else:
				a -= 1
		elif foods[id] == 1:
			if b == 0:
				break
			else:
				b -= 1
		elif foods[id] == 2:
			if c == 0:
				break
			else:
				c -= 1
		cur_day += 1
	days.append(cur_day)
out = day_num + max(days)
print(out)


from sys import stdin
from collections import *

def arr_inp(n):
	if n == 1:
		return [int(x) for x in stdin.readline().split()]
	elif n == 2:
		return [float(x) for x in stdin.readline().split()]
	else:
		return list(stdin.readline()[:-1])
f = arr_inp(1)
(mi, days, d) = (min(f[0] // 3, f[1] // 2, f[2] // 2), deque([i for i in range(7)]), {0: 1, 1: 0, 2: 0, 3: 1, 4: 2, 5: 0, 6: 2})
ans = mi * 7
f[0] -= mi * 3
f[1] -= mi * 2
f[2] -= mi * 2
ma = 0
for i in range(7):
	(tem, f1, flag) = (0, f.copy(), 1)
	for j in range(7):
		if f1[d[days[0]]] and flag:
			f1[d[days[0]]] -= 1
			tem += 1
		else:
			flag = 0
		days.rotate(-1)
	days.rotate(-1)
	(ma, flag) = (max(ma, tem), 1)
print(ans + ma)


schedule = 'abcacba'
abc = list(map(int, input().split()))
a = abc[0]
b = abc[1]
c = abc[2]
multiple = a // 3
if multiple > b // 2:
	multiple = b // 2
if multiple > c // 2:
	multiple = c // 2
aOver = a - multiple * 3
if aOver > 3:
	aOver = 3
bOver = b - multiple * 2
if bOver > 2:
	bOver = 2
cOver = c - multiple * 2
if cOver > 2:
	cOver = 2
max = 0
for i in range(len(schedule)):
	counter = [aOver, bOver, cOver]
	j = 0
	while True:
		if schedule[(i + j) % len(schedule)] == 'a':
			if counter[0] == 0:
				break
			counter[0] -= 1
		elif schedule[(i + j) % len(schedule)] == 'b':
			if counter[1] == 0:
				break
			counter[1] -= 1
		else:
			if counter[2] == 0:
				break
			counter[2] -= 1
		j += 1
	if j > max:
		max = j
result = multiple * 7 + max
print(result)


(a, b, c) = map(int, input().split())
week = min(a // 3, b // 2, c // 2)
a -= week * 3
b -= week * 2
c -= week * 2
mx = -1
for i in range(7):
	(x, y, z) = (a, b, c)
	for j in range(7):
		num = (i + j) % 7
		if num == 0 or num == 3 or num == 6:
			x -= 1
		elif num == 2 or num == 4:
			z -= 1
		else:
			y -= 1
		if x < 0 or y < 0 or z < 0:
			break
	mx = max(mx, j)
print(week * 7 + mx)


def main():
	(a, b, c) = (int(i) for i in input().split())
	ans = min(a // 3, b // 2, c // 2)
	a -= ans * 3
	b -= ans * 2
	c -= ans * 2
	ans *= 7
	if c == 0:
		if b == 0:
			if a == 0:
				pass
			else:
				ans += 2
		elif b == 1:
			if a == 0:
				ans += 1
			elif a == 1:
				ans += 2
			else:
				ans += 3
		elif a == 0:
			ans += 1
		elif a == 1:
			ans += 2
		else:
			ans += 4
	elif c == 1:
		if b == 0:
			if a == 0:
				ans += 1
			else:
				ans += 2
		elif b == 1:
			if a == 0:
				ans += 2
			elif a == 1:
				ans += 3
			elif a == 2:
				ans += 4
			else:
				ans += 5
		elif a == 0:
			ans += 2
		elif a == 1:
			ans += 3
		elif a == 2:
			ans += 5
		else:
			ans += 6
	elif b == 0:
		if a == 0:
			ans += 1
		else:
			ans += 3
	elif b == 1:
		if a == 0:
			ans += 2
		elif a == 1:
			ans += 4
		elif a == 2:
			ans += 5
		else:
			ans += 6
	elif a == 0:
		ans += 2
	elif a == 1:
		ans += 5
	elif a == 2:
		ans += 6
	else:
		ans += 7
	print(ans)
main()


(a, b, c) = map(int, input().split())
m = min(a // 3, b // 2, c // 2)
ans = 7 * m
a = min(3, a - 3 * m)
b = min(2, b - 2 * m)
c = min(2, c - 2 * m)
a = ('1' * a).zfill(3)
b = ('1' * b).zfill(2)
c = ('1' * c).zfill(2)
m = 0
for x in range(3):
	for y in range(2):
		for z in range(2):
			d = a[x:] + a[:x]
			e = b[y:] + b[:y]
			f = c[z:] + c[:z]
			s = d[0] + e[0] + f[0] + d[1] + f[1] + e[1] + d[2]
			m = max(m, max(max([len(h) for h in s.split(sep='0')]), 7 - len(s.strip('1'))))
ans += m
print(ans)


__version__ = '1.0'
__date__ = '2019-04-16'
import sys

def count_days(a, b, c):
	weeks = min(a // 3, b // 2, c // 2)
	a -= weeks * 3
	b -= weeks * 2
	c -= weeks * 2
	if a == 0:
		if b > 0:
			if c > 0:
				return weeks * 7 + 2
			else:
				return weeks * 7 + 1
		elif c > 0:
			return weeks * 7 + 1
	elif a == 1:
		if c > 1:
			return weeks * 7 + 3 + min(2, b)
		else:
			return weeks * 7 + 1 + min(1, b) + min(1, c)
	elif a == 2:
		if b > 0:
			if b > 1:
				return weeks * 7 + 4 + min(2, c)
			elif c > 0:
				return weeks * 7 + 4
		else:
			return weeks * 7 + 2
	elif c == 0:
		return weeks * 7 + 2 + min(2, b)
	elif c > 1:
		if b == 1:
			return weeks * 7 + 6
		else:
			return weeks * 7 + 3
	elif b > 0:
		return weeks * 7 + 4 + min(2, b)
	else:
		return weeks * 7 + 2
	return weeks * 7

def main(argv=None):
	(a, b, c) = map(int, input().split())
	print(count_days(a, b, c))
	return 0
STATUS = main()
sys.exit(STATUS)


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		cc = [self.next_int() for _ in range(0, 3)]
		ds = [0, 1, 2, 0, 2, 1, 0]
		week = min(cc[0] // 3, min(cc[1] // 2, cc[2] // 2))
		cc[0] -= 3 * week
		cc[1] -= 2 * week
		cc[2] -= 2 * week
		ans = 0
		for i in range(0, 7):
			c = cc.copy()
			days = 0
			for j in range(0, 7):
				d = (i + j) % 7
				if c[ds[d]] > 0:
					c[ds[d]] -= 1
					days += 1
				else:
					break
			ans = max(ans, days)
		print(ans + 7 * week)
Main().solve()


(a, b, c) = map(int, input().split())
d = a
e = b
f = c
a //= 3
b //= 2
c //= 2
m = min(a, b, c)
a = d - 3 * m
b = e - 2 * m
c = f - 2 * m
if a > 3:
	a = 3
if b > 2:
	b = 2
if c > 2:
	c = 2
nd = m * 7
li = [['011', '122', '122'], ['123', '234', '235'], ['223', '345', '456'], ['223', '356', '46']]
nd += int(li[a][b][c])
print(nd)


import sys
input = sys.stdin.readline
(a, b, c) = map(int, input().split())
x = max(min(a // 3, b // 2, c // 2) - 1, 0)
a -= 3 * x
b -= 2 * x
c -= 2 * x
s = [0, 1, 2, 0, 2, 1, 0]
m = 0
for i in range(7):
	ok = [0] * 3
	(ok[0], ok[1], ok[2]) = (a, b, c)
	j = 0
	while ok[s[(i + j) % 7]]:
		ok[s[(i + j) % 7]] -= 1
		j += 1
	m = max(m, j)
ans = 7 * x + m
print(ans)


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)


(a, b, c) = map(int, input().split())
(na, nb, nc) = (a // 3, b // 2, c // 2)
ans = min(na, nb, nc)
(a, b, c) = (a - 3 * ans, b - 2 * ans, c - 2 * ans)
food = [1, 2, 3, 1, 3, 2, 1] * 2
mx = 0
for i in range(7):
	var = [0, a, b, c]
	k = 0
	for j in range(i, 14):
		if var[food[j]] == 0:
			break
		var[food[j]] -= 1
		k += 1
	mx = max(mx, k)
print(mx + ans * 7)


(a, b, c) = map(int, input().split())
week = 0
week = min(a // 3, b // 2, c // 2)
a -= week * 3
b -= week * 2
c -= week * 2
game = 0
l = [a, b, c, a, c, b, a]
for i in range(0, 7):
	c = 0
	s = i
	temp = list(l)
	while temp[s] > 0:
		if s == 1 or s == 5:
			temp[1] -= 1
			temp[5] -= 1
		elif s == 0 or s == 3 or s == 6:
			temp[0] -= 1
			temp[3] -= 1
			temp[6] -= 1
		elif s == 2 or s == 4:
			temp[2] -= 1
			temp[4] -= 1
		c += 1
		s = (s + 1) % 7
	game = max(game, c)
print(game + week * 7)


l = list(map(int, input().split()))
x = min(l[0] // 3, l[1] // 2, l[2] // 2)
l[0] -= 3 * x
l[1] -= 2 * x
l[2] -= 2 * x
x *= 7
lista = [0, 1, 2, 0, 2, 1, 0] * 2
m = c = 0
a = [i for i in l]
for i in lista:
	if l[i]:
		c += 1
		l[i] -= 1
	else:
		c = 0
		l = [j for j in a]
	m = max(m, c)
print(x + m)


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) = map(int, input().split())
m = min(int(a / 3), int(b / 2), int(c / 2))
a -= 3 * m
b -= 2 * m
c -= 2 * m
n = -1
for before in range(0, 7, 1):
	for day in range(7):
		for after in range(0, 7, 1):
			aa = a
			bb = b
			cc = c
			for x in range(before):
				w1 = (day + x) % 7
				if w1 == 0 or w1 == 3 or w1 == 6:
					aa -= 1
				elif w1 == 1 or w1 == 5:
					bb -= 1
				else:
					cc -= 1
			day = (day + before) % 7
			for x in range(after):
				w1 = (day + x) % 7
				if w1 == 0 or w1 == 3 or w1 == 6:
					aa -= 1
				elif w1 == 1 or w1 == 5:
					bb -= 1
				else:
					cc -= 1
			if aa >= 0 and bb >= 0 and (cc >= 0):
				if before + after > n:
					n = before + after
print(7 * m + n)


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)


d = {0: 0, 1: 1, 2: 2, 3: 0, 4: 2, 5: 1, 6: 0}
(a, b, c) = map(int, input().split())
ap = a // 3
bp = b // 2
cp = c // 2
p = min([ap, bp, cp])
if p == 0:
	(amod, bmod, cmod) = (a, b, c)
else:
	amod = a - p * 3
	bmod = b - p * 2
	cmod = c - p * 2
num = 7 * p
num1 = 0
for i in range(7):
	j = 0
	q = [amod, bmod, cmod]
	while min(q) >= 0:
		q[d[(j + i) % 7]] -= 1
		j += 1
	num1 = max(num1, j - 1)
print(num + num1)


(a, b, c) = map(int, input().split(' '))
tt = min(a // 3, b // 2, c // 2)
ans = 7 * tt
a1 = a - 3 * tt
a2 = b - 2 * tt
a3 = c - 2 * tt
temp_ans = 0
listi = [0, 1, 2, 0, 2, 1, 0]
Arr = [a1, a2, a3]
for i in range(7):
	Arr1 = Arr[:]
	tt_ans = 0
	for j in range(7):
		Arr1[listi[j]] -= 1
		if Arr1[listi[j]] < 0:
			break
		tt_ans += 1
	temp_ans = max(tt_ans, temp_ans)
	listi = listi[1:] + listi[0:1]
print(temp_ans + ans)


import copy
WANTED = [0, 1, 2, 0, 2, 1, 0]
WANTED_EACH_WEEK = {food_type: WANTED.count(food_type) for food_type in set(WANTED)}
DAYS = len(WANTED)

def count_days_in_week(food, start_day):
	for i in range(start_day, DAYS):
		if food[WANTED[i]] <= 0:
			return (i - start_day, False)
		food[WANTED[i]] -= 1
	return (DAYS - start_day, True)

def count_weeks(food):
	weeks = min((food[i] // WANTED_EACH_WEEK[i] for i in range(len(food))))
	for i in range(len(food)):
		food[i] -= weeks * WANTED_EACH_WEEK[i]
	return weeks

def count_days(food, start_day):
	(days, finished_first_week) = count_days_in_week(food, start_day)
	if finished_first_week:
		days += 7 * count_weeks(food)
		days += count_days_in_week(food, 0)[0]
	return days

def solve(food):
	return max((count_days(copy.copy(food), i) for i in range(DAYS)))
print(solve([int(tok) for tok in input().split()]))


ll = lambda : list(map(int, input().split()))
[a, b, c] = ll()
tw = min([a // 3, b // 2, c // 2])
td = 7 * tw
re = [a - 3 * tw, b - 2 * tw, c - 2 * tw]
arr = [0, 0, 1, 2, 0, 2, 1]
maxd = 0
for i in range(0, 7):
	x = i
	d = 0
	cre = re[:]
	while cre[arr[x]] != 0:
		d += 1
		cre[arr[x]] -= 1
		x = (x + 1) % 7
	if d > maxd:
		maxd = d
print(td + maxd)


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

def it():
	return int(input())
l = list(mp())
(i, j, k) = l
tcw = min(i // 3, j // 2, k // 2)
l[0] -= 3 * tcw
l[1] -= 2 * tcw
l[2] -= 2 * tcw
x = [0, 1, 2, 0, 2, 1, 0]
ans = 0
for start in range(7):
	b = l.copy()
	day = start
	cur = 0
	while b[x[day]] > 0:
		cur += 1
		b[x[day]] -= 1
		day = (day + 1) % 7
	ans = max(ans, cur)
print(ans + tcw * 7)


def main(a, b, c):
	weeks = min(a // 3, b // 2, c // 2)
	foofs = [0] * 3
	foofs[0] = a - weeks * 3
	foofs[1] = b - weeks * 2
	foofs[2] = c - weeks * 2
	days = [1, 2, 3, 1, 3, 2, 1, 1, 2, 3, 1, 3, 2, 1]
	maxdays = 0
	for i in range(7):
		temp = foofs[:]
		for j in range(7):
			if temp[days[i + j] - 1] == 0:
				break
			temp[days[i + j] - 1] -= 1
		maxdays = max(j, maxdays)
	return maxdays + 7 * weeks
(a, b, c) = map(int, input().split())
print(main(a, b, c))


x = list(map(int, input().split()))
d = {0: 3, 1: 2, 2: 2}
a = [x[i] // d[i] for i in range(3)]
weeks = min(a)
least = a.index(min(a))
b = [x[i] - d[i] * weeks for i in range(3)]
days = weeks * 7
p = [0, 1, 2, 0, 2, 1, 0]
if weeks > 0:
	max_days = 0
	for j in range(7):
		b = [x[i] - d[i] * weeks for i in range(3)]
		cd = 0
		while j < len(p) and b[p[j]] > 0:
			cd += 1
			b[p[j]] -= 1
			j += 1
		if j == len(p) and b[0] > 0:
			cd += 1
			if b[1] > 0:
				cd += 1
				if b[2] > 0:
					cd += 1
		max_days = max(max_days, cd)
	days += max_days
else:
	for j in range(7):
		b = [x[i] - d[i] * weeks for i in range(3)]
		cd = 0
		while j < len(p) and b[p[j]] > 0:
			cd += 1
			b[p[j]] -= 1
			j += 1
		if j == len(p) and b[0] > 0:
			cd += 1
			if b[1] > 0:
				cd += 1
				if b[2] > 0:
					cd += 1
		days = max(days, cd)
print(days)


import os
import sys
from math import *
from collections import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
food = ['Fish', 'Rabbit', 'Chicken', 'Fish', 'Chicken', 'Rabbit', 'Fish']
(f, r, c) = value()
weeks = min(f // 3, r // 2, c // 2)
ans = weeks * 7
f = min(f - weeks * 3, inf)
r = min(r - weeks * 2, inf)
c = min(c - weeks * 2, inf)
ID = {'Fish': f, 'Rabbit': r, 'Chicken': c}
for i in range(7):
	here = 0
	over = defaultdict(int)
	for j in range(7):
		if not ID[food[(i + j) % 7]] - over[food[(i + j) % 7]]:
			break
		else:
			over[food[(i + j) % 7]] += 1
			here += 1
	ans = max(ans, weeks * 7 + here)
print(ans)


(a, b, c) = map(int, input().split())
week = [1, 2, 3, 1, 3, 2, 1]
max_ = 0
for i in range(7):
	(a_, b_, c_) = (a, b, c)
	calc = 0
	flag = 1
	for j in range(7 - i):
		if week[i + j] == 1 and a_:
			a_ -= 1
			calc += 1
		elif week[i + j] == 2 and b_:
			b_ -= 1
			calc += 1
		elif week[i + j] == 3 and c_:
			c_ -= 1
			calc += 1
		else:
			flag = 0
			break
	if flag:
		calc2 = min(a_ // 3, b_ // 2, c_ // 2)
		calc += calc2 * 7
		if calc2:
			a_ -= calc2 * 3
			b_ -= calc2 * 2
			c_ -= calc2 * 2
		i1 = 0
		while 1:
			if week[i1] == 1 and a_:
				calc += 1
				a_ -= 1
			elif week[i1] == 2 and b_:
				calc += 1
				b_ -= 1
			elif week[i1] == 3 and c_:
				calc += 1
				c_ -= 1
			else:
				break
			i1 += 1
	max_ = max(calc, max_)
print(max_)


(a, b, c) = map(int, input().split())
d = min(a // 3, b // 2, c // 2)
a -= d * 3
b -= d * 2
c -= d * 2
d = d * 7
t = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
ans = 0
for i in range(7):
	F = a
	R = b
	C = c
	temp = 0
	for j in range(i, i + 7):
		j = j % 7
		if j in [0, 3, 6]:
			if F > 0:
				temp += 1
				F -= 1
			else:
				break
		elif j in [1, 5]:
			if R > 0:
				temp += 1
				R -= 1
			else:
				break
		elif C > 0:
			temp += 1
			C -= 1
		else:
			break
	ans = max(ans, temp)
print(d + ans)


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
N = 10 ** 9 + 7
a = list(R())
idx = [0, 1, 2, 0, 2, 1, 0]
full = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= full * 3
a[1] -= full * 2
a[2] -= full * 2
full *= 7
ans = full
for day in range(7):
	res = 0
	b = a.copy()
	while b[idx[day]] > 0:
		b[idx[day]] -= 1
		day = (day + 1) % 7
		res += 1
	ans = max(ans, full + res)
print(ans)


(a, b, c) = [int(i) for i in input().split()]
f = min(a // 3, b // 2, c // 2)
w = 'abcacba'
r = [0] * 7
for i in range(7):
	(fa, fb, fc) = (a - f * 3, b - f * 2, c - f * 2)
	j = i
	while fa >= 0 and fb >= 0 and (fc >= 0):
		r[i] += 1
		if w[j] == 'a':
			fa -= 1
		if w[j] == 'b':
			fb -= 1
		if w[j] == 'c':
			fc -= 1
		j = (j + 1) % 7
print(f * 7 + max(max(r) - 1, 0))


a = list(map(int, input().split()))
ind = [0, 1, 2, 0, 2, 1, 0]
cost = [3, 2, 2]
tmp = min([a[i] // cost[i] for i in range(3)])
b = [a[i] - cost[i] * tmp for i in range(3)]
res = tmp * 7
for i in range(7):
	(cur, a) = (tmp * 7, list(b))
	for j in range(7):
		k = (i + j) % 7
		if a[ind[k]] > 0:
			(cur, a[ind[k]]) = (cur + 1, a[ind[k]] - 1)
		else:
			break
	res = max(res, cur)
print(res)


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


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)


(a, b, c) = map(int, input().split())
weeks = min(a // 3, b // 2, c // 2)
a = a - weeks * 3
b = b - weeks * 2
c = c - weeks * 2
arr = [a, b, c]
d = {0: 1, 1: 1, 2: 2, 3: 3, 4: 1, 5: 3, 6: 2}
ans = 0
for x in range(0, 7):
	temp = 0
	val = arr[:]
	for i in range(x, x + 7):
		i %= 7
		pos = d[i] - 1
		if val[pos] <= 0:
			break
		else:
			temp += 1
			val[pos] -= 1
	ans = max(ans, temp)
print(weeks * 7 + ans)


food = list(map(int, input().split()))
day_map = {0: 0, 1: 0, 2: 1, 3: 2, 4: 0, 5: 2, 6: 1}
week = min(food[0] // 3, food[1] // 2, food[2] // 2)
rem_food_1 = [food[0] - week * 3, food[1] - week * 2, food[2] - week * 2]
mx = 0
for start in range(7):
	i = 0
	dow = start
	rem_food = [f for f in rem_food_1]
	while rem_food[day_map[dow]] > 0:
		i += 1
		rem_food[day_map[dow]] -= 1
		dow = (dow + 1) % 7
	if i > mx:
		mx = i
print(mx + week * 7)


ration_number = input()
(fishes, rabbits, chickens) = ration_number.split()
max_days = min(int(fishes) // 3, int(rabbits) // 2, int(chickens) // 2)
array = [0, 0, 1, 2, 0, 2, 1]
array = array + array
fishes = int(fishes) - max_days * 3
rabbits = int(rabbits) - max_days * 2
chickens = int(chickens) - max_days * 2
x = 0
for i in range(int(7)):
	addition = 0
	week = int(i)
	ration_array = [fishes, rabbits, chickens]
	while ration_array[array[week]]:
		addition = addition + 1
		ration_array[array[week]] -= 1
		week += 1
	x = max(x, addition)
print(x + max_days * 7)


(a, b, c) = list(map(int, input().split()))
ans = 7
x = min(int(a / 3), int(b / 2), int(c / 2))
ans *= x
a -= 3 * x
b -= 2 * x
c -= 2 * x
if a >= 3:
	a = 3
if b >= 2:
	b = 2
if c >= 2:
	c = 2
week = 7
m = []
for i in range(week):
	w = i
	s = 0
	a2 = a
	b2 = b
	c2 = c
	while a2 >= 0 and b2 >= 0 and (c2 >= 0) and (a2 + b2 + c2 >= 1):
		if w == 0:
			if a2 == 0:
				break
			a2 = a2 - 1
		elif w == 1:
			if b2 == 0:
				break
			b2 = b2 - 1
		elif w == 2:
			if c2 == 0:
				break
			c2 = c2 - 1
		elif w == 3:
			if a2 == 0:
				break
			a2 = a2 - 1
		elif w == 4:
			if c2 == 0:
				break
			c2 = c2 - 1
		elif w == 5:
			if b2 == 0:
				break
			b2 = b2 - 1
		else:
			if a2 == 0:
				break
			a2 = a2 - 1
		s += 1
		w += 1
		if w > 6:
			w = 0
	m.append(s)
print(ans + max(m))


from copy import copy
arr = [int(x) for x in input().split(' ')]
weeks = min([arr[0] // 3, arr[1] // 2, arr[2] // 2])
a = arr[0] - weeks * 3
b = arr[1] - weeks * 2
c = arr[2] - weeks * 2
res = [a, b, c]
tmp = [0, 1, 2, 0, 2, 1, 0]
mx = 0
for i in range(0, len(tmp)):
	cur = 0
	start = i
	q = copy(res)
	ln = 0
	while q[tmp[start]] > 0:
		q[tmp[start]] -= 1
		ln += 1
		mx = max(mx, ln)
		start = (start + 1) % 7
if weeks > 0:
	mx += weeks * 7
print(mx)


f = [1, 4, 7]
r = [2, 6]
ch = [3, 5]
(a1, b1, c1) = map(int, input().split())
max = -10 ** 18
for i in range(1, 8):
	flag = 0
	cnt = 0
	(a, b, c) = (a1, b1, c1)
	for j in range(i, 8):
		if j in f:
			if a != 0:
				a -= 1
				cnt += 1
			else:
				flag = 1
				break
		if j in r:
			if b != 0:
				b -= 1
				cnt += 1
			else:
				flag = 1
				break
		if j in ch:
			if c != 0:
				c -= 1
				cnt += 1
			else:
				flag = 1
				break
	if flag != 1:
		z1 = a // 3
		z2 = b // 2
		z3 = c // 2
		k = min(z1, z2, z3)
		(a, b, c) = (a - 3 * k, b - 2 * k, c - 2 * k)
		new_count = 0
		for z in range(1, 8):
			if z in f:
				if a != 0:
					a -= 1
					new_count += 1
				else:
					break
			if z in r:
				if b != 0:
					b -= 1
					new_count += 1
				else:
					break
			if z in ch:
				if c != 0:
					c -= 1
					new_count += 1
				else:
					break
		cnt += new_count + 7 * k
	if cnt > max:
		max = cnt
print(max)


(a, b, c) = [int(i) for i in input().split()]
k = min(a // 3, b // 2, c // 2)
ans = k * 7
a -= k * 3
b -= k * 2
c -= k * 2
m = -1
for i in range(7):
	(a2, b2, c2) = (a, b, c)
	for j in range(7):
		k = (i + j) % 7
		if k == 0 or k == 3 or k == 6:
			a2 -= 1
		elif k == 1 or k == 5:
			b2 -= 1
		else:
			c2 -= 1
		if a2 < 0 or b2 < 0 or c2 < 0:
			break
	m = max(m, j)
print(ans + m)


(a, b, c) = list(map(int, input().split()))
weeks = min(a // 3, b // 2, c // 2)
days = 7 * weeks
a -= 3 * weeks
b -= 2 * weeks
c -= 2 * weeks
max_go = 0
eat = [0, 1, 2, 0, 2, 1, 0]
for i in range(7):
	cc = [a, b, c]
	for j in range(7):
		if cc[eat[(i + j) % 7]] > 0:
			cc[eat[(i + j) % 7]] -= 1
		else:
			max_go = max(max_go, days + j)
			break
print(max_go)


(a, b, c) = list(map(int, input().split()))
week = [3, 2, 2]
weeks = [week]
days = [0, 1, 2, 0, 2, 1, 0]
for i in range(6):
	nweek = weeks[-1][:]
	nweek[days[i]] -= 1
	nweek[days[i + 1]] += 1
	weeks.append(nweek)
s = -1
for start in range(len(weeks)):
	ans = 0
	(ca, cb, cc) = (int(a), int(b), int(c))
	cw = weeks[start]
	totWeeks = min([a // 3, b // 2, c // 2])
	ans += totWeeks * 7
	left = (3 * totWeeks, 2 * totWeeks, 2 * totWeeks)
	ca -= left[0]
	cb -= left[1]
	cc -= left[2]
	lst = [ca, cb, cc]
	for day in range(7):
		if lst[days[(start + day) % len(days)]] == 0:
			break
		else:
			lst[days[(start + day) % len(days)]] -= 1
	ans += day
	if ans > s:
		s = ans
print(s)


def clac(x, a, b, c):
	cnt = min(int(a / 3), min(int(b / 2), int(c / 2)))
	ca = a - cnt * 3
	cb = b - cnt * 2
	cc = c - cnt * 2
	cnt *= 7
	for j in range(x, x + 7):
		i = j % 7
		if i == 0:
			if ca:
				ca -= 1
				cnt += 1
			else:
				break
		if i == 1:
			if cb:
				cb -= 1
				cnt += 1
			else:
				break
		if i == 2:
			if cc:
				cc -= 1
				cnt += 1
			else:
				break
		if i == 3:
			if ca:
				ca -= 1
				cnt += 1
			else:
				break
		if i == 4:
			if cc:
				cc -= 1
				cnt += 1
			else:
				break
		if i == 5:
			if cb:
				cb -= 1
				cnt += 1
			else:
				break
		if i == 6:
			if ca:
				ca -= 1
				cnt += 1
			else:
				break
	return cnt
(a, b, c) = map(int, input().split(' '))
ans = 0
for i in range(7):
	ans = max(ans, clac(i, a, b, c))
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
		elif C > 0:
			C -= 1
			day += 1
			anstemp += 1
		if day == 7:
			day = 0
	ans = max(anstemp, ans)
ans += weeks * 7
print(ans)


def dfs(day_l, day_r, a, b, c):
	global span
	if day_l < 1 or day_r > 14:
		return
	if a < 0 or b < 0 or c < 0:
		return
	span = max(span, day_r - day_l + 1)
	if day_l - 1 in [1, 4, 7, 8, 11, 14]:
		dfs(day_l - 1, day_r, a - 1, b, c)
	elif day_l - 1 in [2, 6, 9, 13]:
		dfs(day_l - 1, day_r, a, b - 1, c)
	elif day_l - 1 in [3, 5, 10, 12]:
		dfs(day_l - 1, day_r, a, b, c - 1)
	if day_r + 1 in [1, 4, 7, 8, 11, 14]:
		dfs(day_l, day_r + 1, a - 1, b, c)
	elif day_r + 1 in [2, 6, 9, 13]:
		dfs(day_l, day_r + 1, a, b - 1, c)
	elif day_r + 1 in [3, 5, 10, 12]:
		dfs(day_l, day_r + 1, a, b, c - 1)
(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
if weeks > 0:
	span = 0
	if a > 0:
		(day_min, day_max) = (7, 7)
		dfs(7, 7, a - 1, b, c)
	ans1 = 7 * weeks + span
	span = 0
	(day_min, day_max) = (7, 7)
	dfs(7, 7, a - 1 + 3, b + 2, c + 2)
	ans2 = 7 * (weeks - 1) + span
	print(max(ans1, ans2))
else:
	span = 0
	for i in [4, 5, 6, 7]:
		(day_min, day_max) = (i, i)
		if i in [4, 7]:
			dfs(i, i, a - 1, b, c)
		elif i == 6:
			dfs(i, i, a, b - 1, c)
		else:
			dfs(i, i, a, b, c - 1)
	print(span)


(a, b, c) = map(int, input().strip().split())
(a_can, b_can, c_can) = (a // 3, b // 2, c // 2)
(a_re, b_re, c_re) = (a % 3, b % 2, c % 2)
ans = 0
week = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
for j in range(7):
	index = j
	result = 0
	(d, e, g) = (a_can, b_can, c_can)
	(f, r, ch) = (a_re, b_re, c_re)
	norm = min(a_can, b_can, c_can)
	while True:
		if week[index] == 'f':
			if f <= 0:
				if d - 1 < norm:
					break
				else:
					d -= 1
					f = 2
					result += 1
			else:
				f -= 1
				result += 1
		if week[index] == 'r':
			if r <= 0:
				if e - 1 < norm:
					break
				else:
					e -= 1
					r = 1
					result += 1
			else:
				r -= 1
				result += 1
		if week[index] == 'c':
			if ch <= 0:
				if g - 1 < norm:
					break
				else:
					g -= 1
					ch = 1
					result += 1
			else:
				ch -= 1
				result += 1
		if result > ans:
			ans = result
		index = (index + 1) % 7
print(min(a_can, b_can, c_can) * 7 + ans)


from sys import stdin
(a, b, c) = map(int, stdin.readline().strip().split())
arr = [1, 2, 3, 1, 3, 2, 1]
as1 = 3
bs = 2
cs = 2
x = min(a // as1, b // bs, c // cs)
a = a - x * 3
b = b - x * 2
c = c - x * 2
arr1 = [a, b, c]
arr2 = arr1.copy()
ans = 0
for i in range(7):
	aux = 0
	arr2 = arr1.copy()
	for j in range(7):
		if arr2[arr[(i + j) % 7] - 1] > 0:
			arr2[arr[(i + j) % 7] - 1] -= 1
		else:
			break
		aux += 1
	ans = max(aux, ans)
print(ans + x * 7)


(a, b, c) = map(int, input().split())
mx = min(a // 3, b // 2, c // 2)
ra = [[a - mx * 3, 0], [b - mx * 2, 1], [c - mx * 2, 2]]
ans = mx * 7
rm = [0, 1, 2, 0, 2, 1, 0]
dt = 0
for j in range(7):
	tmp = 0
	rb = [it[0] for it in ra]
	i = j
	while rb[rm[i]] > 0:
		tmp += 1
		rb[rm[i]] -= 1
		i += 1
		i %= 7
	dt = max(dt, tmp)
print(ans + dt)


(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
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) = map(int, input().split())
(n_fish, r_fish) = (a // 3, a % 3)
(n_rabbit, r_rabbit) = (b // 2, b % 2)
(n_chicken, r_chicken) = (c // 2, c % 2)
min_weeks = min(n_fish, n_chicken, n_rabbit)
max_weeks = max(n_fish, n_chicken, n_rabbit)
days_fish = n_fish * 7 + (0, 1, 4)[r_fish]
days_rabbit = n_rabbit * 7 + (2, 6)[r_rabbit]
days_chicken = n_chicken * 7 + (3, 5)[r_chicken]
sunday = min(days_fish, days_chicken, days_rabbit)
days_fish = n_fish * 7 + (0, 3, 6)[r_fish]
days_rabbit = n_rabbit * 7 + (1, 5)[r_rabbit]
days_chicken = n_chicken * 7 + (2, 4)[r_chicken]
monday = min(days_fish, days_chicken, days_rabbit)
days_fish = n_fish * 7 + (2, 5, 6)[r_fish]
days_rabbit = n_rabbit * 7 + (0, 4)[r_rabbit]
days_chicken = n_chicken * 7 + (1, 3)[r_chicken]
tuesday = min(days_fish, days_chicken, days_rabbit)
days_fish = n_fish * 7 + (1, 4, 5)[r_fish]
days_rabbit = n_rabbit * 7 + (3, 6)[r_rabbit]
days_chicken = n_chicken * 7 + (0, 2)[r_chicken]
wednesday = min(days_fish, days_chicken, days_rabbit)
days_fish = n_fish * 7 + (0, 3, 4)[r_fish]
days_rabbit = n_rabbit * 7 + (2, 5)[r_rabbit]
days_chicken = n_chicken * 7 + (1, 6)[r_chicken]
thursday = min(days_fish, days_chicken, days_rabbit)
days_fish = n_fish * 7 + (2, 3, 6)[r_fish]
days_rabbit = n_rabbit * 7 + (1, 4)[r_rabbit]
days_chicken = n_chicken * 7 + (0, 5)[r_chicken]
friday = min(days_fish, days_chicken, days_rabbit)
days_fish = n_fish * 7 + (1, 2, 5)[r_fish]
days_rabbit = n_rabbit * 7 + (0, 3)[r_rabbit]
days_chicken = n_chicken * 7 + (4, 6)[r_chicken]
saturday = min(days_fish, days_chicken, days_rabbit)
print(max(sunday, monday, tuesday, wednesday, thursday, friday, saturday))


food = list(map(int, input().split()))
weekDays = [0, 1, 2, 0, 2, 1, 0]
needInAWeek = [3, 2, 2]
weeks = [int(food[0] / needInAWeek[0]), int(food[1] / needInAWeek[1]), int(food[2] / needInAWeek[2])]
res = min(weeks) * 7
for i in range(0, 3):
	food[i] = food[i] - min(weeks) * needInAWeek[i]
copyWeekDays = weekDays.copy()
copyFood = food.copy()
temp = 0
mx = 0
for i in range(0, 7):
	for j in range(i, 13):
		if copyFood[copyWeekDays[j % 7]] > 0:
			copyFood[copyWeekDays[j % 7]] = copyFood[copyWeekDays[j % 7]] - 1
			temp = temp + 1
		else:
			break
	if temp > mx:
		mx = temp
	copyWeekDays = weekDays.copy()
	copyFood = food.copy()
	temp = 0
res = res + mx
print(res)


(a, b, c) = [int(x) for x in input().split()]
k = min(int(a / 3), int(b / 2), int(c / 2))
d = 7 * k
a -= 3 * k
b -= 2 * k
c -= 2 * k
l = [1, 2, 3, 1, 3, 2, 1]
m = 0
for i in range(0, 7):
	cur = 0
	j = i
	a1 = a
	b1 = b
	c1 = c
	for k in range(0, 7):
		if a1 < 0 or b1 < 0 or c1 < 0:
			break
			print(True)
		if l[j % 7] == 1:
			a1 -= 1
		if l[j % 7] == 2:
			b1 -= 1
		if l[j % 7] == 3:
			c1 -= 1
		j += 1
		cur = cur + 1
	if cur > m:
		m = cur
print(d + m - 1)


weekdays = [0, 1, 2, 0, 2, 1, 0]
mat = []
for i in range(7):
	days = []
	for j in range(7):
		v = [0, 0, 0]
		if i == j:
			v[weekdays[j]] = 1
		days.append(v)
	mat.append(days)
for i in range(7):
	j = (i + 1) % 7
	while j != i:
		mat[i][j] = mat[i][j - 1][:]
		mat[i][j][weekdays[j]] += 1
		j = (j + 1) % 7

def calc_days(a, b, c, i):
	max_days = 1
	j = i
	while True:
		(ax, bx, cx) = mat[i][j]
		if a >= ax and b >= bx and (c >= cx):
			num_days = j - i
			if num_days < 0:
				num_days = num_days + 8
			else:
				num_days = num_days + 1
			max_days = max(max_days, num_days)
		else:
			break
		j = (j + 1) % 7
		if i == j:
			break
	return max_days

def main():
	(a, b, c) = map(int, input().split())
	max_days = 0
	for i in range(7):
		min_sup = min([a // 3, b // 2, c // 2])
		days = 7 * min_sup
		(ra, rb, rc) = [a - 3 * min_sup, b - 2 * min_sup, c - 2 * min_sup]
		(na, nb, nc) = mat[i][(i + 1) % 7]
		if ra >= na and rb >= nb and (rc >= nc):
			days += calc_days(ra, rb, rc, i)
		max_days = max(days, max_days)
	print(max_days)
main()


arr = input()
(A, B, C) = [int(x) for x in arr.split(' ')]
weeks = 0
weeks += min(A // 3, B // 2, C // 2)
A = A - weeks * 3
B = B - weeks * 2
C = C - weeks * 2
res = weeks * 7
if A >= 3:
	A = 3
if B >= 2:
	B = 2
if C >= 2:
	C = 2
table = {}
meal = ['A', 'B', 'C', 'A', 'C', 'B', 'A']
for i in range(7):
	for j in range(7):
		if j >= i:
			d = list(range(i, j + 1))
		if j < i:
			d = list(range(i, 7)) + list(range(0, j + 1))
		tmp_A = A
		tmp_B = B
		tmp_C = C
		for num in d:
			if meal[num] == 'A':
				tmp_A -= 1
			if meal[num] == 'B':
				tmp_B -= 1
			if meal[num] == 'C':
				tmp_C -= 1
		if tmp_A >= 0 and tmp_B >= 0 and (tmp_C >= 0):
			res = max(res, weeks * 7 + len(d))
print(res)


a = list(map(int, input().split()))
full = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= full * 3
a[1] -= full * 2
a[2] -= full * 2
idx = [0, 1, 2, 0, 2, 1, 0]
number_of_days = []
for n in range(7):
	b = list(a)
	day = n
	cur = 0
	while b[idx[day]] > 0:
		b[idx[day]] -= 1
		day = (day + 1) % 7
		cur += 1
	number_of_days.append(full * 7 + cur)
print(max(number_of_days))


(a, b, c) = map(int, input().split())
k = min(a // 3, b // 2, c // 2)
l = []
c1 = 0
ans = 0
l.append(a - 3 * k)
l.append(b - 2 * k)
l.append(c - 2 * k)
s = [0, 1, 2, 0, 2, 1, 0]
for i in range(7):
	c1 = i
	q = 0
	b = l.copy()
	while b[s[c1]] > 0:
		b[s[c1]] -= 1
		q = q + 1
		c1 = (c1 + 1) % 7
	ans = max(ans, 7 * k + q)
print(int(ans))


(a, b, c) = map(int, input().split())
minn = min(a, b, c)
d1 = a // 3
d2 = b // 2
d3 = c // 2
minn = min(d1, d2, d3)
ans = 7 * minn
day = 0
k1 = [1, 4, 7]
k2 = [2, 6]
k3 = [3, 5]
a -= minn * 3
b -= minn * 2
c -= minn * 2
e = 0
for i in range(1, 8):
	day = i
	ans1 = 0
	(a1, b1, c1) = (a, b, c)
	while True:
		day += 1
		if day == 8:
			day = 1
		if day in k1:
			if a1 > 0:
				ans1 += 1
				a1 -= 1
			else:
				break
		if day in k2:
			if b1 > 0:
				ans1 += 1
				b1 -= 1
			else:
				break
		if day in k3:
			if c1 > 0:
				ans1 += 1
				c1 -= 1
			else:
				break
	e = max(ans1, e)
print(ans + e)


(A, B, C) = 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)


rations = input().split()
(f, r, c) = map(int, rations)
(fw, rw, cw) = (f // 3, r // 2, c // 2)
minw = min((fw, rw, cw))
(fr, rr, cr) = (f - minw * 3, r - minw * 2, c - minw * 2)
pattern = [0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0]
best = 0
for start in range(7):
	fc = rc = cc = 0
	days = 0
	for i in range(start, 7 + start):
		meal = pattern[i]
		if meal == 0:
			fc += 1
		elif meal == 1:
			rc += 1
		else:
			cc += 1
		if fc > fr or rc > rr or cc > cr:
			break
		days += 1
	if days > best:
		best = days
daysfromweeks = minw * 7
print(daysfromweeks + best)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

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

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mm = 1000000007

def solve():
	t = 1
	for tt in range(t):
		(a, b, c) = num()
		(x, y, z) = (a // 3, b // 2, c // 2)
		xz = min(x, y, z)
		a -= xz * 3
		b -= xz * 2
		c -= xz * 2
		ans = xz * 7
		xp = [0, 0, 1, 2, 0, 2, 1]
		mx = 0
		for j in range(7):
			xs = [a, b, c]
			i = j
			xc = 0
			while xs[xp[i]] > 0:
				xc += 1
				xs[xp[i]] -= 1
				i += 1
				if i > 6:
					i = i - 7
			mx = max(mx, xc)
		print(ans + mx)
solve()


[a, b, c] = input().split(' ')
a = int(a)
b = int(b)
c = int(c)
days = 0
factor = 10000000
while factor != 1:
	while a > 3 * factor and b > 2 * factor and (c > 2 * factor):
		a -= 3 * factor
		b -= 2 * factor
		c -= 2 * factor
		days += 7 * factor
	factor /= 10
while a > 2 and b > 1 and (c > 1):
	a -= 3
	b -= 2
	c -= 2
	days += 7
if c > 1 and b > 1:
	if a == 0:
		days += 2
	elif a == 1:
		days += 5
	elif a == 2:
		days += 6
elif c > 1 and a > 2:
	if b == 0:
		days += 3
	elif b == 1:
		days += 6
elif b > 1 and a > 2:
	if c == 0:
		days += 4
	elif c == 1:
		days += 6
elif c > 1:
	if b == 0 and a == 0:
		days += 1
	elif b == 0 and a == 1:
		days += 2
	elif b == 0 and a == 2:
		days += 2
	elif b == 1 and a == 0:
		days += 2
	elif b == 1 and a == 1:
		days += 4
	elif b == 1 and a == 2:
		days += 5
elif b > 1:
	if c == 0 and a == 0:
		days += 1
	elif c == 0 and a == 1:
		days += 2
	elif c == 0 and a == 2:
		days += 4
	elif c == 1 and a == 0:
		days += 2
	elif c == 1 and a == 1:
		days += 3
	elif c == 1 and a == 2:
		days += 5
elif a > 2:
	if b == 0 and c == 0:
		days += 2
	elif b == 0 and c == 1:
		days += 2
	elif b == 1 and c == 0:
		days += 3
	elif b == 1 and c == 1:
		days += 5
else:
	days += a + b + c
print(int(days))


def input_one(f=int):
	return f(input().strip())

def input_row(f=int):
	return list(map(f, input_one(str).split()))
(f, r, c) = input_row()
week_f = 3
week_r = 2
week_c = 2
x = f // week_f
y = r // week_r
z = c // week_c
weeks = min(x, y, z)
rem_f = f - weeks * week_f
rem_r = r - weeks * week_r
rem_c = c - weeks * week_c
mns = set()
w = 'FRCFCRFFRCFCRF'
for start in range(7):
	for days in range(8):
		p = w[start:start + days]
		f_ = rem_f - p.count('F')
		r_ = rem_r - p.count('R')
		c_ = rem_c - p.count('C')
		if min(f_, r_, c_) >= 0:
			mns.add(days)
v = max(mns)
print(weeks * 7 + v)


import math
import os
from io import BytesIO, IOBase
import sys
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(a, b, c) = map(int, input().split())
full_weeks = min(a // 3, b // 2, c // 2)
a -= full_weeks * 3
b -= full_weeks * 2
c -= full_weeks * 2
consum = {0: 0, 1: 1, 2: 2, 3: 0, 4: 2, 5: 1, 6: 0}
(orig_a, orig_b, orig_c) = (a, b, c)
best_steps = 0
for i in range(7):
	(a, b, c) = (orig_a, orig_b, orig_c)
	food = [a, b, c]
	steps = i
	while True:
		if food[consum[steps % 7]] == 0:
			break
		else:
			food[consum[steps % 7]] -= 1
		steps += 1
	best_steps = max(best_steps, steps - i)
print(full_weeks * 7 + best_steps)


import sys
s = sys.stdin.read().split()
s = [int(x) for x in s]
days = min(int(s[0] / 3), int(s[1] / 2), int(s[2] / 2))
s[0] -= days * 3
s[1] -= days * 2
s[2] -= days * 2
days *= 7
res = min(s)
if res == s[2]:
	if s[2] == 1:
		if s[1] >= 2:
			days += 2
		else:
			days += s[1]
		if s[0] >= 3:
			days += 3
		else:
			days += s[0]
		if s[1] < 2 and s[0] >= 3:
			days -= 1
		if s[0] < 2 and s[1] >= 2:
			days -= 1
	else:
		if s[1] >= 2:
			days += 2
		else:
			days += s[1]
		if s[0] >= 2:
			days += 2
		else:
			days += s[0]
		if s[0] < 2 and s[1] >= 2:
			days -= 1
elif res == s[1]:
	if s[1] == 0:
		if s[2] >= 2:
			days += 2
		else:
			days += s[2]
		if s[0] >= 1:
			days += 1
		else:
			days += s[0]
		if s[2] >= 2 and s[0] < 1:
			days -= 1
	else:
		if s[2] >= 2:
			days += 2
		else:
			days += s[2]
		if s[0] >= 3:
			days += 3
		else:
			days += s[0]
elif s[0] == 0:
	if s[1] >= 1:
		days += 1
	else:
		days += s[1]
	if s[2] >= 1:
		days += 1
	else:
		days += s[1]
else:
	if s[1] >= 2:
		days += 2
	else:
		days += s[1]
	if s[2] >= 2:
		days += 2
	else:
		days += s[2]
	if s[2] <= 1 and s[1] >= 2:
		days -= 1
print(days + res)


def mp():
	return 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
	m = max(m, cnt)
	cnt = 0
print(7 * k + m)


(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
		elif c1:
			c1 -= 1
		else:
			break
		s += 1
	if s > ma:
		ma = s
	v = G[0]
	del G[0]
	G.append(v)
print(j * 7 + ma)


(a, b, c) = (int(i) for i in input().split())

def solve(a, b, c, k):
	a1 = a // 3
	b1 = b // 2
	c1 = c // 2
	m = min(a1, b1, c1)
	a2 = a - 3 * m
	b2 = b - 2 * m
	c2 = c - 2 * m
	s = a2 + b2 + c2
	for i in range(k, s + 2 + k):
		if a2 == -1 or b2 == -1 or c2 == -1:
			return 7 * m + i - 1 - k
		if i % 7 == 0 or i % 7 == 3 or i % 7 == 6:
			a2 -= 1
		elif i % 7 == 1 or i % 7 == 5:
			b2 -= 1
		else:
			c2 -= 1
	return 7 * m
print(max([solve(a, b, c, i) for i in range(7)]))


(a, b, c) = map(int, input().split())
maxi = 0
ans0 = 0
req = [0, 0, 1, 2, 0, 2, 1]
req1 = req + req
for i in range(0, 7):
	curr = req1[i:i + 7]
	cnt1 = curr.count(0)
	cnt2 = curr.count(1)
	cnt3 = curr.count(2)
	weeks = min(a // cnt1, b // cnt2, c // cnt3)
	rem = [a - weeks * cnt1, b - weeks * cnt2, c - weeks * cnt3]
	cnt = 0
	for i in curr:
		if i == 0:
			if rem[0]:
				cnt += 1
				rem[0] -= 1
			else:
				break
		elif i == 1:
			if rem[1]:
				cnt += 1
				rem[1] -= 1
			else:
				break
		elif i == 2:
			if rem[2]:
				cnt += 1
				rem[2] -= 1
			else:
				break
	maxi = max(maxi, weeks * 7 + cnt)
print(maxi)


def weeks(list):
	a = [3, 2, 2]
	k = min(list[0] // a[0], list[1] // a[1], list[2] // a[2])
	l = ['a', 'a', 'b', 'c', 'a', 'c', 'b']
	max = 0
	i = 0
	while i < len(l):
		(j, z, count) = (i, True, 0)
		b = [list[0] - 3 * k, list[1] - 2 * k, list[2] - 2 * k]
		while j < len(l) and z:
			if l[j] == 'a':
				if b[0] == 0:
					z = False
				else:
					b[0] -= 1
					count += 1
			elif l[j] == 'b':
				if b[1] == 0:
					z = False
				else:
					b[1] -= 1
					count += 1
			elif l[j] == 'c':
				if b[2] == 0:
					z = False
				else:
					b[2] -= 1
					count += 1
			j += 1
			if j >= len(l):
				j = 0
		if count > max:
			max = count
		i += 1
	return k * 7 + max
l = list(map(int, input().strip().split()))
print(weeks(l))


numbers = list(map(int, input().strip().split()))
weeks = [numbers[0] // 3, numbers[1] // 2, numbers[2] // 2]
days = 7 * min(weeks)
remainders = [0] * 3
remainders[0] = numbers[0] % 3 + 3 * (min(weeks) < weeks[0])
for i in range(1, 3):
	remainders[i] = numbers[i] % 2 + 2 * (min(weeks) < weeks[i])
timetable = [0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0]
rest = []
for i in range(7):
	check = remainders[:]
	dummy = 0
	for (i, t) in enumerate(timetable[i:]):
		if check[t] == 0:
			rest.append(dummy)
			break
		else:
			dummy += 1
			check[t] -= 1
print(days + max(rest))


a = list(map(int, input().split()))
full = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= 3 * full
a[1] -= 2 * full
a[2] -= 2 * full
ind = [0, 1, 2, 0, 2, 1, 0]
ans = 0
for start in range(7):
	b = a.copy()
	day = start
	cur = 0
	while b[ind[day]] > 0:
		cur += 1
		b[ind[day]] -= 1
		day = (day + 1) % 7
	ans = max(ans, cur)
print(7 * full + ans)


card = [0, 1, 2, 0, 2, 1, 0]
l = [int(x) for x in input().split()]
semanas = min(l[0] // 3, l[1] // 2)
semanas = min(l[2] // 2, semanas)
(l[0], l[1], l[2]) = (l[0] - 3 * semanas, l[1] - 2 * semanas, l[2] - 2 * semanas)
maximo = -1
for i in range(7):
	(f, r, c) = (l[0], l[1], l[2])
	qtd = 0
	while f >= 0 and r >= 0 and (c >= 0):
		if card[i] == 0:
			f -= 1
		elif card[i] == 1:
			r -= 1
		else:
			c -= 1
		if f != -1 and r != -1 and (c != -1):
			qtd += 1
		i = (i + 1) % 7
	maximo = max(qtd, maximo)
print(semanas * 7 + maximo)


(a, b, c) = map(int, input().split())
aq = a // 3
bq = b // 2
cq = c // 2
l = [1, 2, 3, 1, 3, 2, 1, 1, 2, 3, 1, 3, 2, 1]
n = min(aq, bq, cq)
a = a - 3 * n
b = b - 2 * n
c = c - 2 * n
n = n * 7
ma = 0
for i in range(7):
	j = i
	bo = True
	nb = 0
	ai = a
	bi = b
	ci = c
	while bo:
		if l[j] == 1:
			ai -= 1
			if ai == -1:
				bo = False
			else:
				nb += 1
		elif l[j] == 2:
			bi -= 1
			if bi == -1:
				bo = False
			else:
				nb += 1
		else:
			ci -= 1
			if ci == -1:
				bo = False
			else:
				nb += 1
		j += 1
	if nb > ma:
		ma = nb
print(n + ma)


ar = [int(t) for t in input().split()]
d = [0, 1, 2, 0, 2, 1, 0]
ans = 0
cnt = 0
for i in range(7):
	s = [sum([1 for dd in d if dd == j]) for j in range(3)]
	weeks = min([ar[j] // s[j] if s[j] != 0 else ar[j] for j in range(3) if s[j] != 0])
	cur = weeks * 7
	rem = 0
	tar = [a - s[j] * weeks for (j, a) in enumerate(ar)]
	j = i
	while tar[d[j]] > 0:
		tar[d[j]] -= 1
		j += 1
		j %= 7
		cur += 1
	ans = max(rem + cur, ans)
print(ans)


(a, b, c) = 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 = list(map(int, input().rstrip().split()))
weeks = [a[0] // 3, a[1] // 2, a[2] // 2]
n = min(weeks)
mi = n * 7
res = [a[0] - n * 3, a[1] - n * 2, a[2] - n * 2]
if res[0] == 0:
	print(mi + min(1, res[1]) + min(1, res[2]))
elif res[0] == 1:
	if res[2] == 0:
		print(mi + 1 + min(1, res[1]))
	elif res[2] == 1:
		print(mi + 2 + min(1, res[1]))
	else:
		print(mi + 1 + min(2, res[1]) + min(2, res[2]))
elif res[0] == 2:
	print(mi + 2 + min(2, res[1]) + min(2, res[2]))
elif res[1] <= res[2] and res[1] != 0:
	print(mi + 3 + 1 + min(res[2], 2))
elif res[2] <= res[1] and res[2] != 0:
	print(mi + 1 + 3 + min(res[1], 2))
elif res[1] == 0:
	print(max(mi + 2, mi + 1 + min(2, res[2])))
else:
	print(mi + 2 + min(2, res[1]))


def main(argc, argv) -> {}:
	sync_with_stdio(false)
	cin.tie(0)
	cout.tie(0)
	A = vector << int >> 3
	A <<= cin
	mn = min({A[0] // 3, A[1] // 2, A[2] // 2})
	A[0] -= mn * 3
	A[1] -= mn * 2
	A[2] -= mn * 2
	W = [0, 1, 2, 0, 2, 1, 0]
	extra = 0
	i = 0
	while i < 7 or {}:
		B = [3, 2, 2]
		j = 0
		while j < 7 and (B[0] > A[0] or B[1] > A[1] or B[2] > A[2]) or {}:
			B[W[(i + j) % 7]] -= 1
			j += 1
			{}
		extra = max(extra, 7 - j)
		i += 1
		{}
	cout << 7 * mn + extra << endl
	{}
import base64
exec(base64.decodebytes('cHkyID0gcm91bmQoMC41KQoKaWYgcHkyOgogICAgZnJvbSBmdXR1cmVfYnVpbHRpbnMgaW1wb3J0IGFzY2lpLCBmaWx0ZXIsIGhleCwgbWFwLCBvY3QsIHppcAogICAgcmFuZ2UgPSB4cmFuZ2UKCmRlZiBzeW5jX3dpdGhfc3RkaW8oYik6CiAgICBpZiBiOiByZXR1cm4KICAgIGltcG9ydCBvcywgc3lzCiAgICBmcm9tIGlvIGltcG9ydCBCeXRlc0lPLCBJT0Jhc2UKICAgIAogICAgIyBGYXN0SU8gZm9yIFB5UHkyIGFuZCBQeVB5MyAod29ya3Mgd2l0aCBpbnRlcmFjdGl2ZSkgYnkgUGFqZW5lZ29kCiAgICBjbGFzcyBGYXN0SShvYmplY3QpOgogICAgICAgIGRlZiBfX2luaXRfXyhzZWxmLCBmZD0wLCBidWZmZXJzaXplPTIqKjE0KToKICAgICAgICAgICAgc2VsZi5zdHJlYW0gPSBzdHJlYW0gPSBCeXRlc0lPKCk7IHNlbGYuYnVmZW5kbCA9IDAKICAgICAgICAgICAgZGVmIHJlYWQyYnVmZmVyKCk6CiAgICAgICAgICAgICAgICBzID0gb3MucmVhZChmZCwgYnVmZmVyc2l6ZSArIG9zLmZzdGF0KGZkKS5zdF9zaXplKTsgcG9zID0gc3RyZWFtLnRlbGwoKQogICAgICAgICAgICAgICAgc3RyZWFtLnNlZWsoMCwyKTsgc3RyZWFtLndyaXRlKHMpOyBzdHJlYW0uc2Vlayhwb3MpOyByZXR1cm4gcwogICAgICAgICAgICBzZWxmLnJlYWQyYnVmZmVyID0gcmVhZDJidWZmZXIKICAgICAgICAjIFJlYWQgZW50aXJlIGlucHV0CiAgICAgICAgZGVmIHJlYWQoc2VsZik6CiAgICAgICAgICAgIHdoaWxlIHNlbGYucmVhZDJidWZmZXIoKTogcGFzcwogICAgICAgICAgICByZXR1cm4gc2VsZi5zdHJlYW0ucmVhZCgpIGlmIHNlbGYuc3RyZWFtLnRlbGwoKSBlbHNlIHNlbGYuc3RyZWFtLmdldHZhbHVlKCkKICAgICAgICBkZWYgcmVhZGxpbmUoc2VsZik6CiAgICAgICAgICAgIHdoaWxlIHNlbGYuYnVmZW5kbCA9PSAwOiBzID0gc2VsZi5yZWFkMmJ1ZmZlcigpOyBzZWxmLmJ1ZmVuZGwgKz0gcy5jb3VudChiIlxuIikgKyAobm90IHMpCiAgICAgICAgICAgIHNlbGYuYnVmZW5kbCAtPSAxOyByZXR1cm4gc2VsZi5zdHJlYW0ucmVhZGxpbmUoKQogICAgICAgIGRlZiBpbnB1dChzZWxmKTogcmV0dXJuIHNlbGYucmVhZGxpbmUoKS5yc3RyaXAoYidcclxuJykKICAgICAgICAKICAgICAgICAjIFJlYWQgYWxsIHJlbWFpbmluZyBpbnRlZ2VycywgdHlwZSBpcyBnaXZlbiBieSBvcHRpb25hbCBhcmd1bWVudAogICAgICAgIGRlZiByZWFkbnVtYmVycyhzZWxmLCB6ZXJvPTApOgogICAgICAgICAgICBjb252ID0gb3JkIGlmIHB5MiBlbHNlIGxhbWJkYSB4OngKICAgICAgICAgICAgQSA9IFtdOyBudW1iID0gemVybzsgc2lnbiA9IDE7IGMgPSBiIi0iWzBdCiAgICAgICAgICAgIGZvciBjIGluIHNlbGYucmVhZCgpOgogICAgICAgICAgICAgICAgaWYgYyA+PSBiIjAiWzBdOiBudW1iID0gMTAgKiBudW1iICsgY29udihjKSAtIDQ4CiAgICAgICAgICAgICAgICBlbGlmIGMgPT0gYiItIlswXTogc2lnbiA9IC0xCiAgICAgICAgICAgICAgICBlbGlmIGMgIT0gYiJcciJbMF06IEEuYXBwZW5kKHNpZ24qbnVtYik7IG51bWIgPSB6ZXJvOyBzaWduID0gMQogICAgICAgICAgICBpZiBjID49IGIiMCJbMF06IEEuYXBwZW5kKHNpZ24qbnVtYikKICAgICAgICAgICAgcmV0dXJuIEEKICAgIAogICAgY2xhc3MgRmFzdE8oSU9CYXNlKToKICAgICAgICBkZWYgX19pbml0X18oc2VsZiwgZmQ9MSk6CiAgICAgICAgICAgIHN0cmVhbSA9IEJ5dGVzSU8oKQogICAgICAgICAgICBzZWxmLmZsdXNoID0gbGFtYmRhOiBvcy53cml0ZSgxLCBzdHJlYW0uZ2V0dmFsdWUoKSkgYW5kIG5vdCBzdHJlYW0udHJ1bmNhdGUoMCkgYW5kIHN0cmVhbS5zZWVrKDApCiAgICAgICAgICAgIHNlbGYud3JpdGUgPSBzdHJlYW0ud3JpdGUgaWYgcHkyIGVsc2UgbGFtYmRhIHM6IHN0cmVhbS53cml0ZShzLmVuY29kZSgpKQogICAgCiAgICBzeXMuc3RkaW4sIHN5cy5zdGRvdXQgPSBGYXN0SSgpLCBGYXN0TygpCiAgICBnbG9iYWwgaW5wdXQKICAgIGlucHV0ID0gc3lzLnN0ZGluLmlucHV0CgoKaW1wb3J0IHN5cwoKY2xhc3Mgb3N0cmVhbToKICAgIGRlZiBfX2xzaGlmdF9fKHNlbGYsYSk6CiAgICAgICAgaWYgYSA9PSBlbmRsOgogICAgICAgICAgICBzeXMuc3Rkb3V0LndyaXRlKCJcbiIpCiAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHN5cy5zdGRvdXQud3JpdGUoc3RyKGEpKQogICAgICAgIHJldHVybiBzZWxmCiAgICBkZWYgdGllKHNlbGYsIHZhbCk6cGFzcwpjb3V0ID0gb3N0cmVhbSgpCmVuZGwgPSBvYmplY3QoKQoKY2xhc3MgaXN0cmVhbToKICAgIHRpZWR0byA9IGNvdXQKICAgIGlucCA9IE5vbmUKICAgIGRlZiBfX3Jsc2hpZnRfXyhhLGIpOgogICAgICAgIGlmIGEudGllZHRvID09IGNvdXQ6CiAgICAgICAgICAgIHN5cy5zdGRvdXQuZmx1c2goKQogICAgICAgIGlmIHR5cGUoYik9PXR1cGxlIG9yIHR5cGUoYik9PWxpc3Q6CiAgICAgICAgICAgIHJldHVybiB0eXBlKGIpKHR5cGUoYykoYS5nZXQoKSkgZm9yIGMgaW4gYikKICAgICAgICByZXR1cm4gdHlwZShiKShhLmdldCgpKQogICAgZGVmIHRpZShzZWxmLCB2YWwpOgogICAgICAgIHNlbGYudGllZHRvID0gdmFsCiAgICBkZWYgZ2V0KGEpOgogICAgICAgIHdoaWxlIG5vdCBhLmlucDoKICAgICAgICAgICAgYS5pbnAgPSBzeXMuc3RkaW4ucmVhZGxpbmUoKS5zcGxpdCgpWzo6LTFdCiAgICAgICAgcmV0dXJuIGEuaW5wLnBvcCgpCmNpbiA9IGlzdHJlYW0oKQoKY2xhc3MgVmVjdG9yOgogICAgZGVmIF9fbHNoaWZ0X18oc2VsZiwgb3RoZXIpOgogICAgICAgIHNlbGYudHlwZSA9IG90aGVyCiAgICAgICAgcmV0dXJuIHNlbGYKICAgIGRlZiBfX3JzaGlmdF9fKHNlbGYsIG90aGVyKToKICAgICAgICBpZiB0eXBlKG90aGVyKSA9PSB0dXBsZToKICAgICAgICAgICAgcmV0dXJuIFtzZWxmLnR5cGUob3RoZXJbMV0pXSpvdGhlclswXQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIHJldHVybiBbc2VsZi50eXBlKCldKm90aGVyCnZlY3RvciA9IFZlY3RvcigpCg=='.encode()))
true = True
false = False
main(len(sys.argv), sys.argv)


(a, b, c) = map(int, input().split())
d = min(a // 3, b // 2, c // 2)
(a, b, c) = (a - 3 * d, b - 2 * d, c - 2 * d)
w = [1, 2, 3, 1, 3, 2, 1]
x = 0
m = 0
while x < 7:
	(xa, xb, xc) = (a, b, c)
	ci = 0
	y = 0
	xi = x
	while y < 7:
		d1 = w[xi % 7]
		if d1 == 1:
			ci += 1
			xa -= 1
		elif d1 == 2:
			ci += 1
			xb -= 1
		else:
			ci += 1
			xc -= 1
		if xa < 0 or xb < 0 or xc < 0:
			ci -= 1
			break
		y += 1
		xi += 1
	if ci > m:
		m = ci
	x += 1
print(7 * d + m)


(a, b, c) = [int(x) for x in input().split()]
ar = [a // 3, b // 2, c // 2]
weeks = min(ar)
left = [a - 3 * weeks, b - 2 * weeks, c - 2 * weeks]
week = [0, 1, 2, 0, 2, 1, 0]
ans = 0
for i in range(7):
	hi = 0
	temp = left[:]
	while temp[week[(i + hi) % 7]] > 0:
		temp[week[(i + hi) % 7]] -= 1
		hi += 1
	ans = max(ans, hi)
print(weeks * 7 + ans)


def shift(l, i):
	return l[i:] + l[:i]
diet = [0, 1, 2, 0, 2, 1, 0]
(f, r, c) = map(int, input().split())
result = 0
for i in range(7):
	wl = [f, r, c]
	rl = [0, 0, 0]
	wdiet = shift(diet, i)
	done = False
	for d in wdiet:
		if rl[d] == wl[d]:
			done = True
			break
		rl[d] += 1
	if not done:
		pl = [a // b for (a, b) in zip(wl, rl)]
		dup = min(pl)
		for j in range(len(wl)):
			wl[j] -= rl[j] * dup
		rl = [0, 0, 0]
		for d in wdiet:
			if rl[d] == wl[d]:
				break
			rl[d] += 1
		total = f + r + c - sum(wl) + sum(rl)
	else:
		total = sum(rl)
	result = max(result, total)
print(result)


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
x = min(a // 3, b // 2, c // 2)
a1 = a - 3 * x
b1 = b - 2 * x
c1 = c - 2 * x
max = 0
for i in range(1, 8):
	d = 0
	a1 = a - 3 * x
	b1 = b - 2 * x
	c1 = c - 2 * x
	while True:
		if (d + i) % 7 == 0:
			a1 -= 1
			if a1 < 0:
				break
		if (d + i) % 7 == 1:
			a1 -= 1
			if a1 < 0:
				break
		if (d + i) % 7 == 2:
			b1 -= 1
			if b1 < 0:
				break
		if (d + i) % 7 == 3:
			c1 -= 1
			if c1 < 0:
				break
		if (d + i) % 7 == 4:
			a1 -= 1
			if a1 < 0:
				break
		if (d + i) % 7 == 5:
			c1 -= 1
			if c1 < 0:
				break
		if (d + i) % 7 == 6:
			b1 -= 1
			if b1 < 0:
				break
		d += 1
	if d > max:
		max = d
print(x * 7 + max)


inp = lambda cast=int: list(map(cast, input().split()))
(f, r, c) = ('f', 'r', 'c')
sched = [f, r, c, f, c, r, f]
(fs, rs, cs) = inp()
cycles = min([fs // 3, rs // 2, cs // 2])
fs -= cycles * 3
rs -= cycles * 2
cs -= cycles * 2
mx = 0
for i in range(7):
	ff = fs
	rr = rs
	cc = cs
	curr = cycles * 7
	for j in range(7):
		idx = (i + j) % 7
		if sched[idx] == f and ff > 0:
			ff -= 1
		elif sched[idx] == r and rr > 0:
			rr -= 1
		elif sched[idx] == c and cc > 0:
			cc -= 1
		else:
			mx = max(mx, curr)
			break
		curr += 1
print(mx)


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(a, b, c) = MAP()
week = [0, 0, 1, 2, 0, 2, 1]
aw = a // 3
bw = b // 2
cw = c // 2
mnw = min(aw, bw, cw)
a -= mnw * 3
b -= mnw * 2
c -= mnw * 2
ans = 0
for i in range(7):
	abc = [a, b, c]
	cnt = 0
	for j in range(7):
		day = (i + j) % 7
		if abc[week[day]] > 0:
			abc[week[day]] -= 1
			cnt += 1
		else:
			break
	ans = max(ans, cnt)
ans += mnw * 7
print(ans)


(a, b, c) = map(int, input().split())
weeks = min(a // 3, b // 2, c // 2)
a -= weeks * 3
b -= weeks * 2
c -= weeks * 2
A = [0, 1, 2, 0, 2, 1, 0]
chmax = 0
for i in range(7):
	ost = [a, b, c]
	day = i
	ch = 0
	while True:
		ost[A[day]] -= 1
		if ost[A[day]] < 0:
			break
		day += 1
		if day == 7:
			day = 0
		ch += 1
	if ch > chmax:
		chmax = ch
print(7 * weeks + chmax)


(A, B, C) = map(int, input().split())
daylist = ['A', 'A', 'B', 'C', 'A', 'C', 'B'] * 2
arr = []
for i in range(7):
	arr.append(daylist[i:7 + i])
num = []
week = [A // 3, B // 2, C // 2]
minweek = min(week)
offset = minweek * 7
A = A - minweek * 3
B = B - minweek * 2
C = C - minweek * 2
for i in range(7):
	daylist2 = arr[i]
	cnt = 0
	AA = A
	BB = B
	CC = C
	while AA >= 0 and BB >= 0 and (CC >= 0):
		food = daylist2[cnt % 7]
		if food == 'A':
			AA -= 1
		if food == 'B':
			BB -= 1
		if food == 'C':
			CC -= 1
		cnt += 1
	num.append(cnt)
print(max(num) - 1 + offset)


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

def cal(i, a, b, c, ans):
	if a >= 3 and b >= 2 and (c >= 2):
		x = min(a // 3, b // 2, c // 2)
		return cal(i, a - 3 * x, b - 2 * x, c - 2 * x, ans + 7 * x)
	elif i == 1 or i == 4 or i == 0:
		if a == 0:
			return ans
		else:
			return cal((i + 1) % 7, a - 1, b, c, ans + 1)
	elif i == 2 or i == 6:
		if b == 0:
			return ans
		else:
			return cal((i + 1) % 7, a, b - 1, c, ans + 1)
	elif c == 0:
		return ans
	else:
		return cal((i + 1) % 7, a, b, c - 1, ans + 1)
x = max((cal(i, a, b, c, 0) for i in range(7)))
print(x)


a = list(map(int, input().split()))
weeks = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= weeks * 3
a[1] -= weeks * 2
a[2] -= weeks * 2
extra = 0
food = [0, 1, 2, 0, 2, 1, 0]
for i in range(7):
	rest = a[:]
	extdays = 0
	day = i
	while rest[food[day]] > 0:
		extdays += 1
		rest[food[day]] -= 1
		day = (day + 1) % 7
	extra = max(extra, extdays)
print(weeks * 7 + extra)


a = [0, 1, 2, 0, 2, 1, 0]
b = [3, 2, 2]
x = list(map(int, input().split()))
mins = int(min(x[0] / b[0], min(x[1] / b[1], x[2] / b[2])))
rems0 = x[0] - mins * b[0]
rems1 = x[1] - mins * b[1]
rems2 = x[2] - mins * b[2]
temp = 7 * mins
tambah_temp = 0
for j in range(7):
	ans = 0
	(rem0, rem1, rem2) = (rems0, rems1, rems2)
	for i in a:
		if i == 0:
			if rem0 == 0:
				tambah_temp = max(tambah_temp, ans)
				break
			else:
				rem0 -= 1
				ans += 1
		elif i == 1:
			if rem1 == 0:
				tambah_temp = max(tambah_temp, ans)
				break
			else:
				rem1 -= 1
				ans += 1
		elif rem2 == 0:
			tambah_temp = max(tambah_temp, ans)
			break
		else:
			rem2 -= 1
			ans += 1
	w = a[0]
	del a[0]
	a.append(w)
print(temp + tambah_temp)


arr = list(map(int, input().split()))
w = min(arr[0] // 3, arr[1] // 2, arr[2] // 2)
arr = [arr[0] - 3 * w, arr[1] - 2 * w, arr[2] - 2 * w]
week = [0, 1, 2, 0, 2, 1, 0]
ans1 = 0
for l in range(0, 7):
	k = l
	ans = 0
	arr1 = arr[:]
	while arr1.count(-1) == 0:
		arr1[week[k]] -= 1
		k += 1
		k %= 7
		ans += 1
	ans1 = max(ans1, ans + w * 7 - 1)
print(ans1)


key = list(map(int, input().split()))
max_time = 0
x = [0, 1, 2, 0, 2, 1, 0]
for i in range(7):
	(a, b, c) = key[:]
	new_x = (x + x)[i:i + 7]
	weeks = min(a // 3, b // 2, c // 2)
	a -= weeks * 3
	b -= weeks * 2
	c -= weeks * 2
	key_t = [a, b, c]
	j = 0
	while key_t[new_x[j]]:
		key_t[new_x[j]] -= 1
		j += 1
	max_time = max(max_time, weeks * 7 + j)
print(max_time)


(a, b, c) = map(int, input().split())
A = ['a', 'a', 'b', 'c', 'a', 'c', 'b']
x = a // 3
y = b // 2
z = c // 2
ans = min(x, y, z) * 7
s = min(x, y, z)
x -= s
y -= s
z -= s
a = x * 3 + a % 3
b = y * 2 + b % 2
c = z * 2 + c % 2
i = 0
fin_ans = 0
while i < 7:
	j = i
	t = 0
	p = a
	q = b
	r = c
	while True:
		if A[j % 7] == 'a':
			p -= 1
		elif A[j % 7] == 'b':
			q -= 1
		elif A[j % 7] == 'c':
			r -= 1
		if p < 0 or q < 0 or r < 0:
			break
		j += 1
		t += 1
	fin_ans = max(fin_ans, t)
	i += 1
print(ans + fin_ans)


food = list(map(int, input().split()))
f = food[0]
r = food[1]
c = food[2]
k = 0
week = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
rcans = []
result = 0
if f <= r and f <= c:
	k = f // 3
elif r <= f and r <= c:
	k = r // 2
elif c <= r and c <= f:
	k = c // 2
while k * 3 > f:
	k -= 1
result += k * 7
f -= k * 3
r -= k * 2
c -= k * 2
i = 0
while i < 7:
	fy = f
	cy = c
	ry = r
	rcan = 0
	if i == 0:
		for a in week:
			if a == 'f':
				fy -= 1
				if fy >= 0:
					rcan += 1
				else:
					break
			elif a == 'r':
				ry -= 1
				if ry >= 0:
					rcan += 1
				else:
					break
			elif a == 'c':
				cy -= 1
				if cy >= 0:
					rcan += 1
				else:
					break
		rcans.append(rcan)
		i += 1
		continue
	else:
		basa = week[-1]
		del week[-1]
		week.insert(0, basa)
		for a in week:
			if a == 'f':
				fy -= 1
				if fy >= 0:
					rcan += 1
				else:
					break
			elif a == 'r':
				ry -= 1
				if ry >= 0:
					rcan += 1
				else:
					break
			elif a == 'c':
				cy -= 1
				if cy >= 0:
					rcan += 1
				else:
					break
		rcans.append(rcan)
		i += 1
result += max(rcans)
print(result)


(a, b, c) = map(int, input().split())
x = min(a // 3, b // 2, c // 2)
if x:
	x -= 1
ans = x * 7
a -= 3 * x
b -= 2 * x
c -= 2 * x
(aa, bb, cc) = (a, b, c)
temp = 0
for i in range(1, 8):
	(a, b, c) = (aa, bb, cc)
	cnt = 0
	j = i
	while True:
		if (j == 1 or j == 4 or j == 7) and a != 0:
			a -= 1
		elif (j == 2 or j == 6) and b != 0:
			b -= 1
		elif (j == 3 or j == 5) and c != 0:
			c -= 1
		else:
			break
		cnt += 1
		j += 1
		if j > 7:
			j -= 7
	temp = max(temp, cnt)
print(ans + temp)


QUER = [int(i) for i in input().split()]
a = QUER[0]
b = QUER[1]
c = QUER[2]
m = 0
t = min(a // 3, b // 2, c // 2)
a = a - 3 * t
b = b - 2 * t
c = c - 2 * t
d = t * 7
days = [0, 1, 2, 0, 2, 1, 0]
co = 0
ma = 0
t = 0
while t < 7:
	a1 = a
	b1 = b
	c1 = c
	co = 0
	for i in range(7):
		if days[i] == 0:
			if a1 > 0:
				a1 -= 1
				co += 1
			else:
				break
		elif days[i] == 1:
			if b1 > 0:
				b1 -= 1
				co += 1
			else:
				break
		elif days[i] == 2:
			if c1 > 0:
				c1 -= 1
				co += 1
			else:
				break
	ma = max(co, ma)
	days = days[6:] + days[0:6]
	t += 1
print(d + ma)


(a, b, c) = map(int, input().split())
week = [0, 1, 2, 0, 2, 1, 0]
ans = 0
for i in range(7):
	need_f = 0
	need_r = 0
	need_c = 0
	aa = a
	bb = b
	cc = c
	day = 7 - i
	for j in range(i, 7):
		if week[j] == 0:
			need_f += 1
		elif week[j] == 1:
			need_r += 1
		else:
			need_c += 1
	d = min((a - need_f) // 3, (b - need_r) // 2, (c - need_c) // 2)
	dd = 0
	if d <= 0:
		day = 0
		while True:
			if i == 7:
				i = 0
			if week[i] == 0:
				aa -= 1
			if week[i] == 1:
				bb -= 1
			if week[i] == 2:
				cc -= 1
			if aa < 0 or bb < 0 or cc < 0:
				break
			day += 1
			i += 1
	else:
		dd = 0
		day += d * 7
		j = 0
		aa = a - need_f - d * 3
		bb = b - need_r - d * 2
		cc = c - need_c - d * 2
		while True:
			if j == 7:
				j = 0
			if week[j] == 0:
				aa -= 1
			if week[j] == 1:
				bb -= 1
			if week[j] == 2:
				cc -= 1
			if aa < 0 or bb < 0 or cc < 0:
				break
			dd += 1
			j += 1
	ans = max(ans, day + dd)
print(ans)


data = ['a', 'b', 'c', 'a', 'c', 'b', 'a']
x = [int(a) for a in input().split()]
maxim = 0

def count(r, x):
	co = 0
	a = x[0]
	b = x[1]
	c = x[2]
	while a >= 0 and b >= 0 and (c >= 0):
		if data[r] == 'a':
			a -= 1
		elif data[r] == 'b':
			b -= 1
		elif data[r] == 'c':
			c -= 1
		co += 1
		if r == 6:
			r = 0
		else:
			r += 1
	return co - 1
if x[0] > 7 and x[1] > 7 and (x[2] > 7):
	mini = int(x[0] / 3)
	if int(x[1] / 2) < mini:
		mini = int(x[1] / 2)
	if int(x[2] / 2) < mini:
		mini = int(x[2] / 2)
	x[0] -= mini * 3
	x[1] -= mini * 2
	x[2] -= mini * 2
	maxim += mini * 7
maxi = count(0, x)
for i in range(1, 7):
	if maxi < count(i, x):
		maxi = count(i, x)
print(maxim + maxi)


ls = list(map(int, input().split()))
full = min(ls[0] // 3, ls[1] // 2, ls[2] // 2)
ls[0] -= 3 * full
ls[1] -= 2 * full
ls[2] -= 2 * full
arr = [0, 1, 2, 0, 2, 1, 0]
res = []
for i in range(7):
	copy = list(ls)
	j = i
	cnt = 0
	while True:
		if copy[arr[j]] == 0:
			break
		cnt += 1
		copy[arr[j]] -= 1
		j = (j + 1) % 7
	res.append(cnt)
print(max(res) + 7 * full)


from sys import stdin, stdout
(a, b, c) = map(int, stdin.readline().rstrip().split())
days = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
divs = [a // 3, b // 2, c // 2]
divmin = min(divs)
maxi = divmin * 7
if maxi != 0:
	(a, b, c) = (a - divmin * 3, b - divmin * 2, c - divmin * 2)
for i in range(0, 7):
	dayfood = {'f': a, 'r': b, 'c': c}
	k = divmin * 7
	while 1:
		l = days[(k + i) % 7]
		k += 1
		if dayfood[l] == 0:
			break
		else:
			dayfood[l] -= 1
	if k - 1 > maxi:
		maxi = k - 1
print(maxi)


(a, b, c) = (int(x) for x in input().split())
full_a = a // 3
full_b = b // 2
full_c = c // 2
min_full = min((full_a, full_b, full_c))
left_a = a % 3
left_b = b % 2
left_c = c % 2
if full_a == min_full:
	left_a += 3
if full_b == min_full:
	left_b += 2
if full_c == min_full:
	left_c += 2
days = ['a', 'a', 'b', 'c', 'a', 'c', 'b'] * 10
best = 0
if left_a or left_b or left_c:
	if full_a > min_full:
		left_a += 999
	if full_b > min_full:
		left_b += 999
	if full_c > min_full:
		left_c += 999
	for i in range(len(days)):
		d = days[i:]
		(ca, cb, cc) = (left_a, left_b, left_c)
		ans = 0
		for di in d:
			if di == 'a':
				if not ca:
					break
				ca -= 1
				ans += 1
			elif di == 'b':
				if not cb:
					break
				cb -= 1
				ans += 1
			elif di == 'c':
				if not cc:
					break
				cc -= 1
				ans += 1
		best = max(best, ans)
print(7 * (min_full - 1) + best)


def solve():
	(a, b, c) = map(int, input().split())
	w = min(a // 3, b // 2, c // 2)
	cnt = 7 * w
	a -= 3 * w
	b -= 2 * w
	c -= 2 * w
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while ta:
		ans1 += 1
		ta -= 1
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
	ans = ans1
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while ta:
		ans1 += 1
		ta -= 1
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
	ans = ans1
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while ta:
		ans1 += 1
		ta -= 1
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
	ans = max(ans, ans1)
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while tb:
		ans1 += 1
		tb -= 1
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
	ans = max(ans, ans1)
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while tb:
		ans1 += 1
		tb -= 1
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
	ans = max(ans, ans1)
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while tc:
		ans1 += 1
		tc -= 1
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
	ans = max(ans, ans1)
	ans1 = cnt
	(ta, tb, tc) = (a, b, c)
	while tc:
		ans1 += 1
		tc -= 1
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
		if tb > 0:
			ans1 += 1
			tb -= 1
		else:
			break
		if tc > 0:
			ans1 += 1
			tc -= 1
		else:
			break
		if ta > 0:
			ans1 += 1
			ta -= 1
		else:
			break
	print(max(ans, ans1))
solve()


corn = list(map(int, input().split()))
schedule = [0, 1, 2, 0, 2, 1, 0]

def f(day, corn):
	result = 0
	while day != 0:
		if corn[schedule[day]] == 0:
			break
		result += 1
		corn[schedule[day]] -= 1
		day = (day + 1) % 7
	weeks = min(corn[0] // 3, corn[1] // 2, corn[2] // 2)
	corn[0] -= weeks * 3
	corn[1] -= weeks * 2
	corn[2] -= weeks * 2
	result += weeks * 7
	while True:
		if corn[schedule[day]] == 0:
			break
		result += 1
		corn[schedule[day]] -= 1
		day = (day + 1) % 7
	return result
ans = 0
for day in range(7):
	ans = max(ans, f(day, corn[:]))
print(ans)


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
from copy import deepcopy

def solution2(vec):
	eats = [3, 2, 2]
	weeks = [vec[ind] // val for (ind, val) in enumerate(eats)]
	min_weeks = min(weeks)
	vec = [val - eats[ind] * min_weeks for (ind, val) in enumerate(vec)]
	min_days = min_weeks * 7
	best = min_days
	eats = [0, 0, 1, 2, 0, 2, 1]
	for start in range(7):
		food = deepcopy(vec)
		days = min_days
		while True:
			day = (start + days) % 7
			eat = eats[day]
			if food[eat] == 0:
				break
			food[eat] -= 1
			days += 1
		best = max(best, days)
	return best
vec = [int(val) for val in sys.stdin.readline().split()]
print(solution2(vec))


from sys import stdin, stdout
stdin.readline

def mp():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(stdin.readline().strip())
from math import ceil
from collections import defaultdict as dd
from collections import Counter as C
(a, b, c) = mp()
x = min(a // 3, b // 2, c // 2)
l = [a - 3 * x, b - 2 * x, c - 2 * x]
ans = 0
v = [0, 1, 2, 0, 2, 1, 0]
for i in range(7):
	y = l.copy()
	j = i
	res = 0
	while y[v[j]]:
		res += 1
		y[v[j]] -= 1
		j += 1
		j %= 7
	ans = max(ans, res)
print(ans + 7 * x)


eat = []
eat = list(map(int, input().split()))
temp = min(int(eat[0] / 3), int(eat[1] / 2), int(eat[2] / 2))
ans = temp * 7
eat[0] -= temp * 3
eat[1] -= temp * 2
eat[2] -= temp * 2
day = [0, 1, 2, 0, 2, 1, 0]
cir = -1
for i in range(7):
	count = 0
	temp = list.copy(eat)
	for j in range(7):
		if temp[day[(i + j) % 7]] == 0:
			cir = max(cir, count)
			break
		count += 1
		temp[day[(i + j) % 7]] -= 1
print(ans + cir)


import sys
from collections import Counter
sys.setrecursionlimit(10 ** 7)
(a, b, c) = map(int, input().split())
n = min(a // 3, b // 2, c // 2)
a -= 3 * n
b -= 2 * n
c -= 2 * n
(x, y, z) = (a, b, c)
ans = 7 * n
ans_a = 0
s = 'abcacba' * 10
for i in range(14):
	for j in range(14):
		t = s[i:i + j]
		(x, y, z) = (a, b, c)
		for k in range(len(t)):
			if t[k] == 'a':
				x -= 1
			if t[k] == 'b':
				y -= 1
			if t[k] == 'c':
				z -= 1
		if x >= 0 and y >= 0 and (z >= 0):
			ans_a = max(ans_a, len(t))
print(ans + ans_a)


import sys
a = input()
A = a.split(' ')
twod_list = []
for i in A:
	twod_list.append(int(i))
Array = ['baabcac', 'aabcacb', 'abcacba', 'bcacbaa', 'cacbaab', 'acbaabc', 'cbaabca']
Maxx = 0
Minn = 0
a = twod_list[0]
b = twod_list[1]
c = twod_list[2]
AllDayys = 0
Factor = 0
Factor1 = sys.maxsize
Factor2 = sys.maxsize
Factor3 = sys.maxsize
if a >= 3 and b >= 2 and (c >= 2):
	Minn = min(a, min(b, c))
	Factor1 = int(a / 3)
	Factor2 = int(b / 2)
	Factor3 = int(c / 2)
	Factor = min(Factor1, min(Factor2, Factor3))
	twod_list[0] = twod_list[0] - 3 * Factor
	twod_list[1] = twod_list[1] - 2 * Factor
	twod_list[2] = twod_list[2] - 2 * Factor
	AllDayys = Factor * 7
for i in range(7):
	a = twod_list[0]
	b = twod_list[1]
	c = twod_list[2]
	Counter = 0
	for j in range(7):
		if Array[i][j] == 'a':
			if a > 0:
				a = a - 1
				Counter = Counter + 1
			else:
				break
		elif Array[i][j] == 'b':
			if b > 0:
				b = b - 1
				Counter = Counter + 1
			else:
				break
		elif Array[i][j] == 'c':
			if c > 0:
				c = c - 1
				Counter = Counter + 1
			else:
				break
		Maxx = max(Maxx, Counter)
print(Maxx + AllDayys)


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


(f, r, c) = map(int, input().split())
ans = min(f // 3, r // 2, c // 2)
add = 0
week = [0, 1, 2, 0, 2, 1, 0]
for i in range(0, len(week)):
	food = [f - ans * 3, r - ans * 2, c - ans * 2]
	cnt = 0
	j = i
	while True:
		food[week[j]] -= 1
		if food[week[j]] < 0:
			break
		cnt += 1
		add = max(add, cnt)
		j = j + 1
		if j >= len(week):
			j = 0
print(ans * 7 + add)


kk = lambda : map(int, input().split())
ll = lambda : list(kk())
days = [0, 1, 2, 0, 2, 1, 0]
foods = ll()
fullweeks = min(foods[0] // 3, foods[1] // 2, foods[2] // 2)
foods[0] -= fullweeks * 3
foods[1] -= fullweeks * 2
foods[2] -= fullweeks * 2
mc = 0
for d in range(7):
	x = d
	coun = 0
	f2 = foods.copy()
	while f2[days[x]] > 0:
		f2[days[x]] -= 1
		coun += 1
		x = (x + 1) % 7
	if coun > mc:
		mc = coun
print(fullweeks * 7 + mc)


(a, b, ct) = map(int, input().split())
(ao, bo, co) = (0, 0, 0)
if a > 2:
	a -= 3
	ao = 3
if b > 1:
	b -= 2
	bo = 2
if ct > 1:
	ct -= 2
	co = 2
whole = min(a // 3, b // 2, ct // 2)
a -= whole * 3 - ao
b -= whole * 2 - bo
ct -= whole * 2 - co
c = whole * 7
out = c
for q in range(7):
	lst = [a, b, ct, a, ct, b, a]
	now = c
	for i in range(q, 7):
		if lst[i] == 0:
			j = i - q
			break
		if i == 0 or i == 3 or i == 6:
			lst[0] -= 1
			lst[3] -= 1
			lst[6] -= 1
		elif i == 1 or i == 5:
			lst[1] -= 1
			lst[5] -= 1
		else:
			lst[2] -= 1
			lst[4] -= 1
	else:
		j = 7 - q
		for i in range(7):
			if lst[i] == 0:
				j += i
				break
			if i == 0 or i == 3 or i == 6:
				lst[0] -= 1
				lst[3] -= 1
				lst[6] -= 1
			elif i == 1 or i == 5:
				lst[1] -= 1
				lst[5] -= 1
			else:
				lst[2] -= 1
				lst[4] -= 1
		else:
			j += 7
			for i in range(7):
				if lst[i] == 0:
					j += i
					break
				if i == 0 or i == 3 or i == 6:
					lst[0] -= 1
					lst[3] -= 1
					lst[6] -= 1
				elif i == 1 or i == 5:
					lst[1] -= 1
					lst[5] -= 1
				else:
					lst[2] -= 1
					lst[4] -= 1
	if out < now + j:
		out = now + j
print(out)


def func(params):
	(f, r, c) = params
	cut_f = f // 3
	cut_r = r // 2
	cut_c = c // 2
	d = min(cut_f, cut_r, cut_c)
	res = 7 * d
	f = min(3, f - 3 * d)
	r = min(2, r - 2 * d)
	c = min(2, c - 2 * d)
	if f == 0:
		if r > 0:
			if c > 0:
				res += 2
			else:
				res += 1
		elif c > 0:
			res += 1
		else:
			res += 0
	elif f == 1:
		if r == 2 and c == 0:
			res += 2
		elif r == 2 and c == 1:
			res += 3
		else:
			res += 1 + r + c
	elif f == 2:
		if r == 0 and c == 1:
			res += 2
		elif r == 0 and c == 2:
			res += 3
		else:
			res += 2 + r + c
	elif r == 0 and c == 0:
		res += 2
	elif r == 0 and c == 1:
		res += 2
	elif r == 0 and c == 2:
		res += 3
	elif r == 1 and c == 0:
		res += 3
	elif r == 1 and c == 1:
		res += 5
	elif r == 1 and c == 2:
		res += 6
	elif r == 2 and c == 0:
		res += 4
	elif r == 2 and c == 1:
		res += 6
	elif r == 2 and c == 2:
		res += 7
	print(res)
params = list(map(int, input().split()))
func(params)


(a, b, c) = map(int, input().split())
ans = 0
for i in range(7):
	if i == 1:
		a += 1
	elif i == 2:
		b += 1
	elif i == 3:
		c += 1
	elif i == 4:
		a += 1
	elif i == 5:
		c += 1
	elif i == 6:
		b += 1
	one = a // 3
	two = b // 2
	three = c // 2
	ost_1 = a % 3
	ost_2 = b % 2
	ost_3 = c % 2
	k = min(one, two, three)
	if k == one:
		anss = one * 7
		two = b - one * 2
		three = c - one * 2
		if ost_1 >= 1:
			anss += 1
			if two > 0:
				anss += 1
				if three > 0:
					anss += 1
					if ost_1 == 2:
						anss += 1
						if three > 1:
							anss += 1
							if two > 1:
								anss += 1
	elif k == two:
		anss = two * 7
		one = a - two * 3
		three = c - two * 2
		if ost_2 == 1:
			if one > 0:
				anss += 2
				if three > 0:
					anss += 1
					if one > 1:
						anss += 1
						if three > 1:
							anss += 1
		elif one > 0:
			anss += 1
	else:
		anss = three * 7
		one = a - three * 3
		two = b - three * 2
		if ost_3 == 1:
			if one > 0:
				anss += 1
				if two > 0:
					anss += 2
					if one > 1:
						anss += 1
		elif one > 0:
			anss += 1
			if two > 0:
				anss += 1
	ans = max(anss - i, ans)
print(ans)


def func(x1, x2, x3, day):
	ba = 0
	while 1:
		if day == 8:
			day = 1
		if day == 1 or day == 4 or day == 7:
			if x1 > 0:
				ba += 1
				x1 -= 1
			else:
				break
		elif day == 2 or day == 6:
			if x2 > 0:
				x2 -= 1
				ba += 1
			else:
				break
		elif day == 3 or day == 5:
			if x3 > 0:
				x3 -= 1
				ba += 1
			else:
				break
		day += 1
	return ba

def tillmon(x1, x2, x3, da):
	ba = 0
	while 1:
		if da == 8:
			da = 1
		if da == 1:
			break
		if da == 1 or da == 4 or da == 7:
			if x1 > 0:
				ba += 1
				x1 -= 1
			else:
				break
		elif da == 2 or da == 6:
			if x2 > 0:
				x2 -= 1
				ba += 1
			else:
				break
		elif da == 3 or da == 5:
			if x3 > 0:
				x3 -= 1
				ba += 1
			else:
				break
		da += 1
	return (x1, x2, x3, ba)
(a2, b2, c2) = map(int, input().split())
fina = []
if a2 > 5 and b2 > 5 and (c2 > 5):
	for i in range(1, 8):
		ans = 0
		(a, b, c, dd) = tillmon(a2, b2, c2, i)
		ans += dd
		t1 = a // 3
		t2 = b // 2
		t3 = c // 2
		a = a % 3
		b = b % 2
		c = c % 2
		mini = min(t1, t2, t3)
		ans += (mini - 1) * 7
		a += (t1 - mini + 1) * 3
		b += (t2 - mini + 1) * 2
		c += (t3 - mini + 1) * 2
		ans += func(a, b, c, 1)
		fina.append(ans)
else:
	for i in range(1, 8):
		ans = 0
		ans += func(a2, b2, c2, i)
		fina.append(ans)
print(max(fina))


import copy

def check(j, Days):
	Mays = Days
	if Mays[j % 7] <= 0:
		return 0
	day = 0
	while True:
		if j % 7 == 0 or j % 7 == 4 or j % 7 == 1:
			Mays[0] = Mays[0] - 1
			Mays[1] = Mays[1] - 1
			Mays[4] = Mays[4] - 1
		elif j % 7 == 3 or j % 7 == 5:
			Mays[3] = Mays[3] - 1
			Mays[5] = Mays[5] - 1
		else:
			Mays[2] = Mays[2] - 1
			Mays[6] = Mays[6] - 1
		j = j + 1
		day = day + 1
		if Mays[j % 7] <= 0:
			break
	return day
(ff, rs, cs) = map(int, input().split())
j = 0
full = min(ff // 3, rs // 2, cs // 2)
ff = ff - full * 3
rs = rs - full * 2
cs = cs - full * 2
Days = [ff, ff, rs, cs, ff, cs, rs]
Mays1 = copy.deepcopy(Days)
Mays2 = copy.deepcopy(Days)
Mays3 = copy.deepcopy(Days)
Mays4 = copy.deepcopy(Days)
Mays5 = copy.deepcopy(Days)
Mays6 = copy.deepcopy(Days)
Mays7 = copy.deepcopy(Days)
day = max(check(0, Mays1), check(1, Mays2), check(2, Mays3), check(3, Mays4), check(4, Mays5), check(5, Mays6), check(6, Mays7)) + 7 * full
print(day)


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

def Try(day, a, b, c):
	k = 0
	for x in day:
		if x == 1:
			a -= 1
		if x == 2:
			b -= 1
		if x == 3:
			c -= 1
		if a < 0 or b < 0 or c < 0:
			break
		k += 1
	return k
ans = 7 * min(a // 3, min(b // 2, c // 2))
o = ans // 7
a -= o * 3
b -= o * 2
c -= o * 2
day = [[1, 2, 3, 1, 3, 2, 1], [2, 3, 1, 3, 2, 1, 1], [3, 1, 3, 2, 1, 1, 2], [1, 3, 2, 1, 1, 2, 3], [3, 2, 1, 1, 2, 3, 1], [2, 1, 1, 2, 3, 1, 3], [1, 1, 2, 3, 1, 3, 2]]
i = 0
answer = -1
best = -1
for i in range(7):
	if ans + Try(day[i], a, b, c) > answer:
		answer = ans + Try(day[i], a, b, c)
		best = i + 1
print(answer)


def gourmet_cat(a, b, c):
	fullw = min(a // 3, b // 2, c // 2)
	a -= fullw * 3
	b -= fullw * 2
	c -= fullw * 2
	week = 'abcacba'
	max = 0
	for i in range(len(week)):
		rep = week[i:] + week[:i]
		rep = rep.replace('a', '1', a).replace('b', '1', b).replace('c', '1', c)
		aux = 0
		for i in rep:
			if i == '1':
				aux += 1
			else:
				if aux > max:
					max = aux
				aux = 0
	return fullw * 7 + max
x = list(map(int, input().split()))
print(gourmet_cat(*x))


(a, b, c) = map(int, input().split())
ak = a // 3
bk = b // 2
ck = c // 2
l = [1, 2, 3, 1, 3, 2, 1]
ans = min(ak, bk, ck)
a -= ans * 3
b -= ans * 2
c -= ans * 2
mx = 0
for i in range(7):
	(a1, b1, c1) = (a, b, c)
	y = i
	t = 0
	f = True
	while f:
		if l[y] == 1:
			if a1 > 0:
				a1 -= 1
				t += 1
			else:
				f = False
				mx = max(mx, t)
		elif l[y] == 2:
			if b1 > 0:
				b1 -= 1
				t += 1
			else:
				f = False
				mx = max(mx, t)
		elif c1 > 0:
			c1 -= 1
			t += 1
		else:
			f = False
			mx = max(mx, t)
		if y == 6:
			y = 0
		else:
			y += 1
print(ans * 7 + mx)


(f, r, c) = map(int, input().split())
menu = ['f', 'f', 'r', 'c', 'f', 'c', 'r']
maxCount = 0
for i in range(7):
	step = i
	(ff, rr, cc) = (f, r, c)
	count = 0
	if ff > 3 and rr > 2 and (cc > 2):
		fmax = ff // 3
		rmax = rr // 2
		cmax = cc // 2
		minmax = min(fmax, rmax, cmax)
		(ff, rr, cc) = (ff - 3 * minmax, rr - 2 * minmax, cc - 2 * minmax)
		count += 7 * minmax
	while True:
		if menu[step] == 'f':
			ff -= 1
			if ff < 0:
				break
		elif menu[step] == 'r':
			rr -= 1
			if rr < 0:
				break
		else:
			cc -= 1
			if cc < 0:
				break
		count += 1
		step += 1
		step %= 7
	if count > maxCount:
		maxCount = count
print(maxCount)


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

def can(start, days):
	cura = a
	curb = b
	curc = c
	for j in range(start, 7):
		if typ[j] == 0:
			cura -= 1
		elif typ[j] == 1:
			curb -= 1
		else:
			curc -= 1
		days -= 1
		if days == 0:
			return cura >= 0 and curb >= 0 and (curc >= 0)
	weeks = days // 7
	leftover = days % 7
	cura -= 3 * weeks
	curb -= 2 * weeks
	curc -= 2 * weeks
	for i in range(leftover):
		if typ[i] == 0:
			cura -= 1
		elif typ[i] == 1:
			curb -= 1
		else:
			curc -= 1
	return cura >= 0 and curb >= 0 and (curc >= 0)
ans = 0
for start in range(7):
	lo = 1
	hi = 10 ** 18
	for i in range(200):
		mid = (lo + hi) // 2
		if can(start, mid):
			lo = mid
			ans = max(ans, lo)
		else:
			hi = mid - 1
for start in range(7):
	for j in range(lo - 15, hi + 15):
		if j > 0 and can(start, j):
			ans = max(ans, j)
print(ans)


(a, b, c) = (int(x) for x in input().strip().split(' '))
n = min(a // 3, b // 2, c // 2)
ans = n * 7
a = a - n * 3
b = b - n * 2
c = c - n * 2
L = ['r', 'f', 'f', 'r', 'c', 'f', 'c', 'r', 'f', 'f', 'r', 'c', 'f', 'c']
i = 0
max_count = 0
while i < 7:
	x = a
	y = b
	z = c
	j = i
	i += 1
	count = 0
	while j < 14:
		if x > 0 and L[j] == 'f':
			x -= 1
			count += 1
		elif y > 0 and L[j] == 'r':
			y -= 1
			count += 1
		elif z > 0 and L[j] == 'c':
			z -= 1
			count += 1
		else:
			break
		max_count = max(count, max_count)
		j += 1
ans += max_count
print(ans)


lst = [int(x) for x in input().split()]
days = [0, 1, 2, 0, 2, 1, 0]
weeks = min(lst[0] // 3, lst[1] // 2, lst[2] // 2)
lst[0] -= 3 * weeks
lst[1] -= 2 * weeks
lst[2] -= 2 * weeks
ans = weeks * 7
add = 0
for i in range(7):
	tmp = lst.copy()
	curr = 0
	for j in range(7):
		day = days[(i + j) % 7]
		tmp[day] -= 1
		if tmp[day] < 0:
			break
		curr += 1
	add = max(add, curr)
ans += add
print(ans)


line = input().split(' ')
f = int(line[0])
r = int(line[1])
c = int(line[2])
w1 = int(f / 3)
w2 = int(r / 2)
w3 = int(c / 2)
ans = 0
fr = {'00': 1, '01': 2, '10': 3, '11': 4, '20': 3, '21': 5}
fc = {'00': 1, '01': 2, '10': 2, '11': 3, '20': 4, '21': 5}
rc = {'00': 2, '01': 2, '10': 3, '11': 5}
frc = {'000': 0, '001': 1, '010': 1, '011': 2, '100': 1, '101': 2, '110': 2, '111': 3, '200': 2, '201': 2, '210': 3, '211': 4}
if w1 < w2 and w1 < w3:
	re = f % 3
	if re == 0:
		ans = w1 * 7 + 2
	elif re == 1:
		ans = w1 * 7 + 5
	elif re == 2:
		ans = w1 * 7 + 6
elif w2 < w1 and w2 < w3:
	re = r % 2
	if re == 0:
		ans = w2 * 7 + 3
	elif re == 1:
		ans = w2 * 7 + 6
elif w3 < w1 and w3 < w2:
	re = c % 2
	if re == 0:
		ans = w3 * 7 + 4
	elif re == 1:
		ans = w3 * 7 + 6
elif w1 == w2 and w1 < w3:
	re1 = f % 3
	re2 = r % 2
	feature = str(re1) + str(re2)
	ans = w1 * 7 + fr[feature]
elif w1 == w3 and w1 < w2:
	re1 = f % 3
	re3 = c % 2
	feature = str(re1) + str(re3)
	ans = w1 * 7 + fc[feature]
elif w2 == w3 and w2 < w1:
	re2 = r % 2
	re3 = c % 2
	feature = str(re2) + str(re3)
	ans = w2 * 7 + rc[feature]
else:
	re1 = f % 3
	re2 = r % 2
	re3 = c % 2
	feature = str(re1) + str(re2) + str(re3)
	ans = w1 * 7 + frc[feature]
print(ans)


(a, b, c) = map(int, input().split())
s = 'aabcacb'

def fa(x):
	return x // 7 * 3 + s[:x % 7].count('a')

def fb(x):
	return x // 7 * 2 + s[:x % 7].count('b')

def fc(x):
	return x // 7 * 2 + s[:x % 7].count('c')

def go(d):
	(lo, hi) = (d, 2000020000)
	while lo < hi:
		mid = (lo + hi + 1) // 2
		if fa(mid) - fa(d) > a or fb(mid) - fb(d) > b or fc(mid) - fc(d) > c:
			hi = mid - 1
		else:
			lo = mid
	return lo - d
print(max((go(d) for d in range(7))))


(a, b, c) = map(int, input().split())
a1 = a // 3
b1 = b // 2
c1 = c // 2
otv = 0
otv += min(a1, b1, c1) * 7
a = a // 3 * 7 + a % 3
b = b // 2 * 7 + b % 2
c = c // 2 * 7 + c % 2
a -= otv
b -= otv
c -= otv
if a > 3:
	a = 3
if b > 2:
	b = 2
if c > 2:
	c = 2
a1 = a
b1 = b
c1 = c
sum = a + b + c
ned = 'abcacbaabcacba'
ab = 0
cou = 0
for i in range(7):
	a = a1
	b = b1
	c = c1
	cou = 0
	kon = 0
	for j in range(i, i + 7):
		if kon == 1:
			continue
		if ned[j] == 'a':
			if a - 1 < 0:
				kon = 1
				continue
			a -= 1
			cou += 1
		if ned[j] == 'b':
			if b - 1 < 0:
				kon = 1
				continue
			b -= 1
			cou += 1
		if ned[j] == 'c':
			if c - 1 < 0:
				kon = 1
				continue
			c -= 1
			cou += 1
	if cou > ab:
		ab = cou
otv += ab
print(otv)


(a, b, c) = map(int, input().split())
acount = a // 3
bcount = b // 2
ccount = c // 2
weeks = min(acount, bcount, ccount)
arest = a - weeks * 3
brest = b - weeks * 2
crest = c - weeks * 2
if arest == 0:
	if brest == 0:
		if crest == 0:
			print(weeks * 7)
		else:
			print(weeks * 7 + 1)
	elif crest == 0:
		print(weeks * 7 + 1)
	else:
		print(weeks * 7 + 2)
elif arest == 1:
	if brest == 0:
		if crest == 0:
			print(weeks * 7 + 1)
		elif crest == 1:
			print(weeks * 7 + 2)
		elif crest > 1:
			print(weeks * 7 + 3)
	if brest == 1:
		if crest == 0:
			print(weeks * 7 + 2)
		elif crest == 1:
			print(weeks * 7 + 3)
		elif crest > 1:
			print(weeks * 7 + 4)
	if brest > 1:
		if crest == 0:
			print(weeks * 7 + 2)
		elif crest == 1:
			print(weeks * 7 + 3)
		elif crest > 1:
			print(weeks * 7 + 5)
elif arest == 2:
	if brest == 0:
		if crest == 0 or crest == 1:
			print(weeks * 7 + 2)
		elif crest > 1:
			print(weeks * 7 + 4)
	if brest == 1:
		if crest == 0:
			print(weeks * 7 + 3)
		elif crest == 1:
			print(weeks * 7 + 4)
		elif crest > 1:
			print(weeks * 7 + 5)
	if brest > 1:
		if crest == 0:
			print(weeks * 7 + 4)
		elif crest == 1:
			print(weeks * 7 + 5)
		elif crest > 1:
			print(weeks * 7 + 6)
elif arest > 2:
	if brest == 0:
		if crest == 0 or crest == 1:
			print(weeks * 7 + 2)
		elif crest > 1:
			print(weeks * 7 + 3)
	elif brest == 1:
		if crest == 0:
			print(weeks * 7 + 3)
		elif crest == 1:
			print(weeks * 7 + 5)
		elif crest > 1:
			print(weeks * 7 + 6)
	elif brest > 1:
		if crest == 0:
			print(weeks * 7 + 4)
		elif crest == 1:
			print(weeks * 7 + 6)


(a, b, c) = map(int, input().split())
full = min(a // 3, b // 2, c // 2)
a -= full * 3
b -= full * 2
c -= full * 2
ans = full * 7
mx = 0
for i in range(1, 8):
	day = i
	x = a
	y = b
	z = c
	days = 0
	while True:
		if day == 1 or day == 4 or day == 7:
			x -= 1
			if x < 0:
				break
		elif day == 2 or day == 6:
			y -= 1
			if y < 0:
				break
		else:
			z -= 1
			if z < 0:
				break
		day = day % 7 + 1
		days += 1
	mx = max(mx, days)
print(ans + mx)


(a, b, c) = [int(i) for i in str.split(input())]
l = [a, a, b, c, a, c, b]
w = [a // 3, b // 2, c // 2]
m = min(w)
l[0] -= m * 3
l[1] -= m * 3
l[2] -= m * 2
l[3] -= m * 2
l[4] -= m * 3
l[5] -= m * 2
l[6] -= m * 2
m_max = -1
for i in range(len(l)):
	ctr = 0
	ll = l[:]
	for j in range(len(l)):
		index = (i + j) % len(l)
		if ll[index] <= 0:
			break
		else:
			if index in [0, 1, 4]:
				ll[0] -= 1
				ll[1] -= 1
				ll[4] -= 1
			elif index in [2, 6]:
				ll[2] -= 1
				ll[6] -= 1
			else:
				ll[3] -= 1
				ll[5] -= 1
			ctr += 1
	m_max = max([ctr, m_max])
print(m * 7 + m_max)


(a, b, c) = map(int, input().split())
f1 = a // 3
f2 = b // 2
f3 = c // 2
wks = min(f1, f2, f3)
a -= 3 * wks
b -= 2 * wks
c -= 2 * wks
var = 'abcacba'
total = 0
for i in range(7):
	ans = 0
	na = a
	nb = b
	nc = c
	ind = i
	while True:
		if var[ind % 7] == 'a':
			if na:
				na -= 1
				ans += 1
			else:
				break
		if var[ind % 7] == 'b':
			if nb:
				nb -= 1
				ans += 1
			else:
				break
		if var[ind % 7] == 'c':
			if nc:
				nc -= 1
				ans += 1
			else:
				break
		ind += 1
	total = max(ans, total)
print(wks * 7 + total)


rations = list(map(int, input().split()))
x = 7 * min(rations[0] // 3, rations[1] // 2, rations[2] // 2)
rations[0] -= 3 * (x // 7)
rations[1] -= 2 * (x // 7)
rations[2] -= 2 * (x // 7)
days = [0, 1, 2, 0, 2, 1, 0]
r = [x] * 7
for i in range(7):
	a = rations[:]
	j = i
	while a[days[j]]:
		a[days[j]] -= 1
		j += 1
		j %= 7
		r[i] += 1
print(max(r))


f = [0, 1, 2, 0, 2, 1, 0]

def calc(a, i):
	res = 0
	while True:
		if a[f[i]] == 0:
			break
		a[f[i]] -= 1
		res += 1
		i += 1
		i %= 7
	return res
a = list(map(int, input().split()))
x = min(a[0] // 3, a[1] // 2, a[2] // 2)
print(x * 7 + max((calc([a[0] - x * 3, a[1] - x * 2, a[2] - x * 2], i) for i in range(7))))


from sys import stdin
import math
from collections import defaultdict, deque

def check(arr, num):
	myset = set()
	for i in range(len(arr)):
		if arr[i] < num:
			myset.add(num - arr[i])
		elif arr[i] > num:
			myset.add(arr[i] - num)
	if len(myset) <= 1:
		return True
	else:
		return False
(a, b, c) = list(map(int, stdin.readline().split()))
first = a // 3
second = b // 2
third = c // 2
complete_weeks = min(first, second, third)
ans = 7 * complete_weeks
a -= complete_weeks * 3
b -= complete_weeks * 2
c -= complete_weeks * 2
gtemp = -float('inf')
for i in range(0, 7):
	temp = 0
	ca = a
	cb = b
	cc = c
	today = i
	while True:
		if today == 0 or today == 3 or today == 6:
			if ca > 0:
				ca -= 1
				temp += 1
				today = (today + 1) % 7
			else:
				break
		elif today == 1 or today == 5:
			if cb > 0:
				cb -= 1
				temp += 1
				today = (today + 1) % 7
			else:
				break
		elif today == 2 or today == 4:
			if cc > 0:
				cc -= 1
				temp += 1
				today = (today + 1) % 7
			else:
				break
	gtemp = max(gtemp, temp)
print(ans + gtemp)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	(a, b, c) = [int(x) for x in stdin.readline().split()]
	weeks = min(floor(a / 3), floor(b / 2), floor(c / 2))
	a -= weeks * 3
	b -= weeks * 2
	c -= weeks * 2
	w = 'abcacba'
	maxd = 0
	for s in range(len(w)):
		d = 0
		da = 0
		db = 0
		dc = 0
		i = s
		while True:
			if w[i] == 'a':
				if da >= a:
					break
				da += 1
			if w[i] == 'b':
				if db >= b:
					break
				db += 1
			if w[i] == 'c':
				if dc >= c:
					break
				dc += 1
			d += 1
			i = (i + 1) % 7
		maxd = max(maxd, d)
	res = weeks * 7 + maxd
	stdout.write('%d' % res)
	return 0
main()


food = list(map(int, input().split()))
perWeek = [3, 2, 2]
oneWeek = [0, 1, 2, 0, 2, 1, 0]

def NoNegatives(food):
	return min(food) >= 0

def getBestWeekday(food):
	bestDays = 0
	for i in range(7):
		currFood = food.copy()
		days = 0
		while True:
			currFood[oneWeek[(i + days) % 7]] -= 1
			if not NoNegatives(currFood):
				if days > bestDays:
					bestDays = days
				break
			days += 1
	return bestDays
if any((food[i] // perWeek[i] < 2 for i in range(3))):
	print(getBestWeekday(food))
else:
	weeks = min([food[i] // perWeek[i] for i in range(3)])
	food = [food[i] - (weeks - 2) * perWeek[i] for i in range(3)]
	print((weeks - 2) * 7 + getBestWeekday(food))


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:
		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)


(a, b, c) = map(int, input().split())
x = []
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 0
elif a % 3 == 1:
	dr += 3
else:
	dr += 6
dk = b // 2 * 7
if b % 2 == 0:
	dk += 1
else:
	dk += 5
do = c // 2 * 7
if c % 2 == 0:
	do += 2
else:
	do += 4
x.append(min(dr, dk, do))
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 2
elif a % 3 == 1:
	dr += 5
else:
	dr += 6
dk = b // 2 * 7
if b % 2 == 0:
	dk += 0
else:
	dk += 4
do = c // 2 * 7
if c % 2 == 0:
	do += 1
else:
	do += 3
x.append(min(dr, dk, do))
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 1
elif a % 3 == 1:
	dr += 4
else:
	dr += 5
dk = b // 2 * 7
if b % 2 == 0:
	dk += 3
else:
	dk += 6
do = c // 2 * 7
if c % 2 == 0:
	do += 0
else:
	do += 2
x.append(min(dr, dk, do))
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 0
elif a % 3 == 1:
	dr += 3
else:
	dr += 4
dk = b // 2 * 7
if b % 2 == 0:
	dk += 2
else:
	dk += 5
do = c // 2 * 7
if c % 2 == 0:
	do += 1
else:
	do += 6
x.append(min(dr, dk, do))
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 2
elif a % 3 == 1:
	dr += 3
else:
	dr += 6
dk = b // 2 * 7
if b % 2 == 0:
	dk += 1
else:
	dk += 4
do = c // 2 * 7
if c % 2 == 0:
	do += 0
else:
	do += 5
x.append(min(dr, dk, do))
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 1
elif a % 3 == 1:
	dr += 2
else:
	dr += 5
dk = b // 2 * 7
if b % 2 == 0:
	dk += 0
else:
	dk += 3
do = c // 2 * 7
if c % 2 == 0:
	do += 4
else:
	do += 6
x.append(min(dr, dk, do))
dr = 0
dk = 0
do = 0
dr = a // 3 * 7
if a % 3 == 0:
	dr += 0
elif a % 3 == 1:
	dr += 1
else:
	dr += 4
dk = b // 2 * 7
if b % 2 == 0:
	dk += 2
else:
	dk += 6
do = c // 2 * 7
if c % 2 == 0:
	do += 3
else:
	do += 5
x.append(min(dr, dk, do))
otvet = max(x)
print(otvet)


(fish, rabbit, chicken) = list(map(int, input().split()))
max_ans = -float('inf')
temp_ans = 0
if fish > 3 and rabbit > 2 and (chicken > 2):
	asd = min(fish // 3, rabbit // 2)
	asda = min(asd, chicken // 2)
	fish -= asda * 3
	rabbit -= asda * 2
	chicken -= asda * 2
	temp_ans = asda * 7
for i in range(7):
	f = fish
	r = rabbit
	c = chicken
	day = i
	temp = 0
	while f >= 0 and r >= 0 and (c >= 0):
		if day % 7 == 0 or day % 7 == 3 or day % 7 == 6:
			f -= 1
		elif day % 7 == 1 or day % 7 == 5:
			r -= 1
		elif day % 7 == 2 or day % 7 == 4:
			c -= 1
		temp += 1
		day += 1
	max_ans = max(temp - 1, max_ans)
print(max_ans + temp_ans)


import sys
import math

def main(args):
	food_choice = [0, 1, 2, 0, 2, 1, 0]
	(a, b, c) = map(int, input().split())
	res = 0
	for d in range(7):
		cnt = 0
		ar = [a, b, c]
		for i in range(d, 7):
			v = food_choice[i]
			if not ar[v]:
				break
			cnt += 1
			ar[v] -= 1
		f = min(ar[0] // 3, min(ar[1], ar[2]) // 2)
		(ar[0], ar[1], ar[2]) = (ar[0] - 3 * f, ar[1] - 2 * f, ar[2] - 2 * f)
		cnt += f * 7
		for v in food_choice:
			if not ar[v]:
				break
			cnt += 1
			ar[v] -= 1
		res = max(res, cnt)
	print(res)
sys.exit(main(sys.argv))


(a, b, c) = map(int, input().split())
nbSemaine = min(a // 3, b // 2, c // 2)
a -= nbSemaine * 3
b -= nbSemaine * 2
c -= 2 * nbSemaine
tt = 7 * nbSemaine
nourr = [a, b, c]
tab = [0, 1, 2, 0, 2, 1, 0]

def simuler(jour):
	nourr2 = list(nourr)
	passe = 0
	while nourr2[tab[jour]]:
		nourr2[tab[jour]] -= 1
		jour = (jour + 1) % 7
		passe += 1
	return passe
ajout = 0
for i in range(7):
	ajout = max(ajout, simuler(i))
print(tt + ajout)


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


k = [int(i) for i in input().split()]
p = []
res = 0
for (i, j) in enumerate(k):
	if i == 0:
		p.append(j // 3)
	else:
		p.append(j // 2)
m = min(p)
m_index = p.index(m)
for i in range(len(k)):
	if i == 0:
		k[i] = k[i] - 3 * m
		res = res + 3 * m
	else:
		k[i] = k[i] - 2 * m
		res = res + 2 * m
schedule = [1, 2, 3, 1, 3, 2, 1]
res1 = []
for i in range(7):
	j = i
	p = k.copy()
	res2 = res
	while True:
		if p[schedule[j] - 1] != 0:
			res2 += 1
			p[schedule[j] - 1] -= 1
		else:
			res1.append(res2)
			break
		j += 1
		j = j % 7
print(max(res1))


def solve(start, a, b, c):
	week = 'abcacba'
	count = 0
	for i in range(start, 7):
		if week[i] == 'a':
			if a <= 0:
				return count
			a -= 1
			count += 1
		elif week[i] == 'b':
			if b <= 0:
				return count
			b -= 1
			count += 1
		elif week[i] == 'c':
			if c <= 0:
				return count
			c -= 1
			count += 1
		else:
			assert False
	skip = min(a // 3, b // 2, c // 2)
	count += 7 * skip
	a -= skip * 3
	b -= skip * 2
	c -= skip * 2
	for i in range(7):
		if week[i] == 'a':
			if a <= 0:
				return count
			a -= 1
			count += 1
		elif week[i] == 'b':
			if b <= 0:
				return count
			b -= 1
			count += 1
		elif week[i] == 'c':
			if c <= 0:
				return count
			c -= 1
			count += 1
		else:
			assert False
	assert False
(a, b, c) = [int(x) for x in str(input()).split(' ')]
best = 0
for i in range(7):
	best = max(best, solve(i, a, b, c))
print(best)


(a, b, c) = map(int, input().strip().split())
ans = 0
basi = min(c // 2, min(b // 2, a // 3))
aa = a - 3 * basi
bb = b - 2 * basi
cc = c - 2 * basi
mp = {0: 'aa', 1: 'aa', 2: 'bb', 3: 'cc', 4: 'aa', 5: 'cc', 6: 'bb'}
for i in range(7):
	aaa = aa
	bbb = bb
	ccc = cc
	an = 0
	for j in range(i, i + 15):
		if mp[j % 7] == 'aa':
			aaa -= 1
		if mp[j % 7] == 'bb':
			bbb -= 1
		if mp[j % 7] == 'cc':
			ccc -= 1
		if aaa < 0 or bbb < 0 or ccc < 0:
			break
		else:
			an += 1
	ans = max(ans, basi * 7 + an)
print(ans)


(a1, b1, c1) = map(int, input().split())
lst = ['r', 'k', 'o', 'r', 'o', 'k', 'r', 'r', 'k', 'o', 'r', 'o', 'k', 'r']
e = min(a1 // 3, b1 // 2, c1 // 2)
(a, b, c) = (a1 - 3 * e, b1 - 2 * e, c1 - 2 * e)
res = 0
for i in range(7):
	x = lst[i]
	(a2, b2, c2, j) = (a, b, c, i)
	while a >= 0 and b >= 0 and (c >= 0):
		y = lst[j]
		if y == 'r':
			a -= 1
		elif y == 'k':
			b -= 1
		else:
			c -= 1
		j += 1
	(a, b, c) = (a2, b2, c2)
	res = max(res, j - i - 1)
print(res + e * 7)


A = 0
B = 1
C = 2
WEEK = (A, B, C, A, C, B, A)
FULL = (3, 2, 2)

def find_best_start_day(abc):
	bestdays = 0
	beststart = None
	for start in range(len(WEEK)):
		diddays = 0
		abccopy = abc[:]
		day_inx = start
		while True:
			food_type = WEEK[day_inx]
			if abccopy[food_type] == 0:
				break
			abccopy[food_type] -= 1
			diddays += 1
			day_inx = (day_inx + 1) % len(WEEK)
		if diddays > bestdays:
			bestdays = diddays
			beststart = start
	return (beststart, bestdays)
abc = [int(i) for i in input().strip().split(' ')]
days = 0
gap_weeks = 2
has_much_food = all((e > max(FULL) * gap_weeks for e in abc))
if has_much_food:
	inx = 0
	min_weeks = (abc[0] - FULL[0] * gap_weeks) // FULL[0]
	for (i, food) in enumerate(abc):
		thisweeks = (abc[i] - FULL[i] * gap_weeks) // FULL[i]
		if thisweeks < min_weeks:
			min_weeks = thisweeks
			inx = i
	assert min_weeks >= 1
	for (i, food) in enumerate(abc):
		abc[i] = food - min_weeks * FULL[i]
	days += min_weeks * len(WEEK)
(start_day, diddays) = find_best_start_day(abc)
days += diddays
print(days)


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
import re
pattern = '0+'
(a, b, c) = list(map(int, input().split()))
week = [3, 2, 2]
weeks = [week]
days = [0, 1, 2, 0, 2, 1, 0]
for i in range(6):
	nweek = weeks[-1][:]
	nweek[days[i]] -= 1
	nweek[days[i + 1]] += 1
	weeks.append(nweek)
s = -1
for start in range(len(weeks)):
	ans = 0
	(ca, cb, cc) = (int(a), int(b), int(c))
	cw = weeks[start]
	totWeeks = min([a // 3, b // 2, c // 2])
	ans += totWeeks * 7
	left = (3 * totWeeks, 2 * totWeeks, 2 * totWeeks)
	ca -= left[0]
	cb -= left[1]
	cc -= left[2]
	lst = [ca, cb, cc]
	for day in range(7):
		if lst[days[(start + day) % len(days)]] == 0:
			break
		else:
			lst[days[(start + day) % len(days)]] -= 1
	ans += day
	if ans > s:
		s = ans
print(s)


def C():
	input_ = input().split()
	inp_a = int(input_[0])
	inp_b = int(input_[1])
	inp_c = int(input_[2])
	max_ = 0
	for i in range(7):
		l = []
		l.append(inp_a // 3)
		l.append(inp_b // 2)
		l.append(inp_c // 2)
		koef = min(l)
		days_count = 7 * koef
		if koef != 0:
			a = inp_a - 3 * koef
			b = inp_b - 2 * koef
			c = inp_c - 2 * koef
		else:
			a = inp_a
			b = inp_b
			c = inp_c
		flag = True
		while flag:
			day = (days_count + i) % 7
			if day == 0 or day == 3 or day == 6:
				if a != 0:
					a -= 1
					days_count += 1
				else:
					flag = False
			elif day == 1 or day == 5:
				if b != 0:
					b -= 1
					days_count += 1
				else:
					flag = False
			elif c != 0:
				c -= 1
				days_count += 1
			else:
				flag = False
		if days_count > max_:
			max_ = days_count
	print(max_)
C()


import sys

def input():
	return sys.stdin.readline().strip()

def print(*x, sep=' ', end='\n'):
	return sys.stdout.write(sep.join(map(str, x)) + end)

def read():
	return sys.stdin.read()

def get():
	return map(int, input().split())

def out(*arg):
	if type(arg[0]) == list:
		for i in arg[0]:
			print(i)
	else:
		print(arg)

def main():
	(a, b, c) = get()
	ans = 7 * min(a // 3, b // 2, c // 2)
	a -= 3 * ans // 7
	b -= 2 * ans // 7
	c -= 2 * ans // 7
	anses = []
	curd = 0
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	curd = 1
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	curd = 2
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	curd = 3
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	curd = 4
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	curd = 5
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	curd = 6
	cnt = 0
	buff_a = a
	buff_b = b
	buff_c = c
	while True:
		if curd == 0 or curd == 3 or curd == 6:
			buff_a -= 1
			if buff_a < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		elif curd == 1 or curd == 5:
			buff_b -= 1
			if buff_b < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
		else:
			buff_c -= 1
			if buff_c < 0:
				break
			curd += 1
			curd %= 7
			cnt += 1
	anses.append(cnt)
	ans += max(anses)
	print(ans)
main()


from collections import Counter
(f, r, c) = map(int, input().split())
s = min(f // 3, r // 2, c // 2)
f -= 3 * s
r -= 2 * s
c -= 2 * s
d = s * 7
ma = d
for i in range(7):
	x = d
	ff = f
	rr = r
	cc = c
	for j in range(i, i + 7):
		if j % 7 == 0 or j % 7 == 3 or j % 7 == 6:
			ff -= 1
		elif j % 7 == 1 or j % 7 == 5:
			rr -= 1
		else:
			cc -= 1
		x += 1
		if ff == -1 or cc == -1 or rr == -1:
			x -= 1
			break
	ma = max(ma, x)
print(ma)


num = list(map(int, input().split()))
(a, b, c) = (num[0], num[1], num[2])
ans = 0
arr = [0, 1, 2, 0, 2, 1, 0]
full = min(a // 3, b // 2, c // 2)
num[0] -= full * 3
num[1] -= full * 2
num[2] -= full * 2
(a, b, c) = (num[0], num[1], num[2])
for start in range(7):
	pt = start
	cnt = full * 7
	prr = [i for i in num]
	while prr[arr[pt]] > 0:
		prr[arr[pt]] -= 1
		cnt += 1
		pt = (pt + 1) % 7
	ans = max(ans, cnt)
print(ans)


a = [*map(int, input().split())]
l = [0, 1, 2, 0, 2, 1, 0]
s = [3, 2, 2]
res = 0
for i in range(7):
	ans = [0] * 3
	b = [*a]
	for j in range(i, 7):
		if b[l[j]] == 0:
			break
		ans[l[j]] += 1
		b[l[j]] -= 1
	m = min((b[k] // s[k] for k in range(3)))
	for k in range(3):
		b[k] -= m * s[k]
	for j in range(7):
		if b[l[j]] == 0:
			break
		ans[l[j]] += 1
		b[l[j]] -= 1
	res = max(res, 7 * m + sum(ans))
print(res)


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

def cal(p, i):
	ans = 0
	while True:
		if p[d[i]] == 0:
			break
		else:
			p[d[i]] -= 1
			ans += 1
			i += 1
			i %= 7
	return ans
(a, b, c) = map(int, input().split())
x = min(a // 3, b // 2, c // 2)
print(7 * x + max((cal([a - 3 * x, b - 2 * x, c - 2 * x], i) for i in range(7))))


entry = list(map(int, input().split(' ')))
fish = entry[0]
rabbit = entry[1]
chicken = entry[2]
rotation = ['F', 'F', 'R', 'C', 'F', 'C', 'R']
fish_weeks = int(fish / 3)
rabbit_weeks = int(rabbit / 2)
chicken_weeks = int(chicken / 2)
full_weeks = min(fish_weeks, rabbit_weeks, chicken_weeks)
final_fish = fish - full_weeks * 3
final_rabbit = rabbit - full_weeks * 2
final_chicken = chicken - full_weeks * 2
max_days = 0
for i in range(0, 7):
	test_rotation = rotation[i:] + rotation[:i]
	f = final_fish
	r = final_rabbit
	c = final_chicken
	days = 0
	for d in test_rotation:
		if d == 'F':
			if f == 0:
				break
			f -= 1
			days += 1
		if d == 'R':
			if r == 0:
				break
			r -= 1
			days += 1
		if d == 'C':
			if c == 0:
				break
			c -= 1
			days += 1
	if days > max_days:
		max_days = days
print(int(full_weeks * 7) + max_days)


R = lambda : map(int, input().split())
(a, b, c) = R()
d = min(a // 3, b // 2, c // 2)
(a, b, c) = (a - d * 3, b - d * 2, c - d * 2)
idx = (0, 1, 2, 0, 2, 1, 0)

def func(s):
	t = [a, b, c]
	cnt = 0
	while min(t) >= 0:
		t[idx[(s + cnt) % 7]] -= 1
		cnt += 1
	return cnt - 1
print(max(map(func, range(7))) + d * 7)


l = list(map(int, input().split()))
w = [0, 0, 1, 2, 0, 2, 1]
p = l[:]
q = l[:]
p[0] //= 3
p[1] //= 2
p[2] //= 2
q[0] = l[0] - min(p) * 3
q[1] = l[1] - min(p) * 2
q[2] = l[2] - min(p) * 2
c = min(p) * 7
d = 0
e = 0
j = 0
while j < 7:
	i = j
	r = q[:]
	while i < 7:
		i %= 7
		if r[w[i]] > 0:
			e += 1
			r[w[i]] -= 1
		else:
			d = max(d, e)
			e = 0
			break
		i += 1
		i %= 7
	j += 1
print(c + d)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(a, b, c) = map(int, input().split())
	mn = min(a // 3, b // 2, c // 2)
	(tempa, tempb, tempc) = (a - 3 * mn, b - 2 * mn, c - 2 * mn)
	cnt = [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 0, 0), (0, 0, 1), (0, 1, 0), (1, 0, 0)]
	ans = 0
	for i in range(7):
		(ta, tb, tc) = (0, 0, 0)
		mx = 0
		j = i
		while ta <= tempa and tb <= tempb and (tc <= tempc):
			(ta, tb, tc) = (ta + cnt[j % 7][0], tb + cnt[j % 7][1], tc + cnt[j % 7][2])
			mx += 1
			j += 1
		ans = max(mx - 1, ans)
	print(ans + mn * 7)
main()


A = list(map(int, input().split()))
Days = [1, 2, 3, 1, 3, 2, 1]
sum = sum(A)

def tripSucces(index):
	tempList = A[:]
	count = 0
	while tempList[Days[index] - 1] != 0:
		count += 1
		tempList[Days[index] - 1] -= 1
		if index < 6:
			index += 1
		else:
			index = 0
	return count
max = 0
weektemp = 0
while A[0] > 60000 and A[1] > 40000 and (A[2] > 40000):
	weektemp += 10000
	A[0] -= 30000
	A[1] -= 20000
	A[2] -= 20000
while A[0] > 600 and A[1] > 400 and (A[2] > 400):
	weektemp += 100
	A[0] -= 300
	A[1] -= 200
	A[2] -= 200
while A[0] > 6 and A[1] > 4 and (A[2] > 4):
	weektemp += 1
	A[0] -= 3
	A[1] -= 2
	A[2] -= 2
for i in range(7):
	t = tripSucces(i)
	if max < t:
		max = t
	if max == sum:
		break
print(max + weektemp * 7)


xs = list(map(int, input().strip().split(' ')))
eats = [0, 1, 2, 0, 2, 1, 0]
result = -1
for i in range(7):
	x = eats[i:] + eats[0:i]
	counts = {0: 0, 1: 0, 2: 0}
	for y in x:
		counts[y] += 1
	weeks = min(map(lambda c: c[1] // counts[c[0]], enumerate(xs)))
	rem = dict(map(lambda x: (x[0], x[1] - weeks * counts[x[0]]), enumerate(xs)))
	day = 0
	for j in range(7):
		if rem[x[j]] - 1 < 0:
			break
		rem[x[j]] -= 1
		day += 1
	result = max(result, day + 7 * weeks)
print(result)


(a, b, c) = map(int, input().split())
ans = min(a // 3, b // 2, c // 2)
a -= ans * 3
b -= ans * 2
c -= ans * 2
ans *= 7
m = 0
(ta, tb, tc) = (a, b, c)
for i in range(7):
	(a, b, c) = (ta, tb, tc)
	temp = 0
	for j in range(i, i + 7):
		if j % 7 == 0 or j % 7 == 3 or j % 7 == 6:
			if a > 0:
				a -= 1
				temp += 1
			else:
				break
		if j % 7 == 1 or j % 7 == 5:
			if b > 0:
				temp += 1
				b -= 1
			else:
				break
		if j % 7 == 2 or j % 7 == 4:
			if c > 0:
				temp += 1
				c -= 1
			else:
				break
	m = max(m, temp)
print(ans + m)


abc = [int(x) for x in input().split(' ')]
n_weeks = min(abc[0] // 3, min(abc[1] // 2, abc[2] // 2))
abc[0] -= n_weeks * 3
abc[1] -= n_weeks * 2
abc[2] -= n_weeks * 2
n_days = n_weeks * 7
w = [0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0]
ans = 0
for i in range(0, 7):
	days = 0
	temp_abc = abc.copy()
	while True:
		temp_abc[w[days + i]] -= 1
		if temp_abc[w[days + i]] < 0:
			ans = max(ans, days)
			break
		days += 1
ans += n_days
print(ans)


(a, b, c) = [int(x) for x in input().split()]
wa = a // 3
wb = b // 2
wc = c // 2
wks = min(wa, wb, wc)
a -= wks * 3
b -= wks * 2
c -= wks * 2
ans = 0
for i in range(1, 8):
	(acp, bcp, ccp) = (a, b, c)
	for j in range(i, i + 7):
		val = j % 7
		if val == 1 or val == 4 or val == 0:
			if acp == 0:
				break
			acp -= 1
		elif val == 2 or val == 6:
			if bcp == 0:
				break
			bcp -= 1
		else:
			if ccp == 0:
				break
			ccp -= 1
	ans = max(ans, j - i)
ans += wks * 7
print(ans)


def frog(x):
	(la, lb, lc) = (a, b, c)
	add = 0
	while True:
		if use[x] == 0:
			la -= 1
		elif use[x] == 1:
			lb -= 1
		else:
			lc -= 1
		if min(la, lb, lc) < 0:
			return add
		add += 1
		x = (x + 1) % 7
(a, b, c) = map(int, input().split())
full = 1000000000
full = min(full, a // 3)
full = min(full, b // 2)
full = min(full, c // 2)
a -= full * 3
b -= full * 2
c -= full * 2
use = [0, 1, 2, 0, 2, 1, 0]
ans = []
for i in range(7):
	ans.append(frog(i))
print(7 * full + max(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) = map(int, input().split())
week = ['a', 'b', 'c', 'a', 'c', 'b', 'a']
weeks = []
for i in range(7):
	weeks.append(week)
	week = week[1:] + week[0:1]
result = 0

def lastPos(rem, week, val, addition):
	ind = 0
	while ind < len(week):
		if rem == 0 and week[ind] == val:
			return addition + ind
		if week[ind] == val:
			rem -= 1
		ind += 1
for week in weeks:
	(aweeks, bweeks, cweeks) = (a // 3, b // 2, c // 2)
	(ares, bres, cres) = (a % 3, b % 2, c % 2)
	mn = min(lastPos(ares, week, 'a', aweeks * 7), lastPos(bres, week, 'b', bweeks * 7), lastPos(cres, week, 'c', cweeks * 7))
	result = max(result, mn)
print(result)


(a, b, c) = map(int, input().split())
am = a // 3
bm = b // 2
cm = c // 2
weeks = min(am, bm, cm)
am = a - weeks * 3
bm = b - weeks * 2
cm = c - weeks * 2
d = 0
for a in range(min(4, am + 1)):
	for b in range(min(4, bm + 1)):
		for c in range(min(4, cm + 1)):
			for i in range(7):
				(x, y, z) = (a, b, c)
				nb = 0
				for j in range(i, i + 7):
					day = j % 7
					if day == 0 or day == 1 or day == 4:
						if x > 0:
							x = x - 1
							nb = nb + 1
						else:
							d = max(d, nb)
							break
					if day == 2 or day == 6:
						if y > 0:
							y = y - 1
							nb = nb + 1
						else:
							d = max(d, nb)
							break
					if day == 3 or day == 5:
						if z > 0:
							z = z - 1
							nb = nb + 1
						else:
							d = max(d, nb)
							break
print(weeks * 7 + d)


sk = [int(x) for x in input().split()]
ka = [0, 1, 2, 0, 2, 1, 0]
ats = int(1000000000.0)
ats = min(ats, sk[0] // 3, sk[1] // 2, sk[2] // 2)
sk[0] -= ats * 3
sk[1] -= ats * 2
sk[2] -= ats * 2
ats *= 7
prid = 0
curr = 0
for i in range(7):
	if not sk[ka[i]]:
		continue
	curr = 0
	cop = sk[:]
	for j in range(7):
		if cop[ka[(i + j) % 7]] == 0:
			break
		curr += 1
		cop[ka[(i + j) % 7]] -= 1
	prid = max(prid, curr)
print(ats + prid)


(a, b, c) = map(int, input().split())
fish = [0, 1, 4]
rabbit = [2, 6]
chick = [3, 5]
(x, y, z) = (a, b, c)
maxdayCount = 0
count = 0
for start in range(7):
	day = start
	count = 0
	while x > -1 and y > -1 and (z > -1):
		weeks = int(min(x / 3, y / 2, z / 2))
		count += 7 * weeks
		x -= 3 * weeks
		y -= 2 * weeks
		z -= 2 * weeks
		if day in fish:
			x -= 1
		elif day in rabbit:
			y -= 1
		else:
			z -= 1
		if x < 0 or y < 0 or z < 0:
			break
		day += 1
		count += 1
		day = day % 7
	if count > maxdayCount:
		maxdayCount = count
	(x, y, z) = (a, b, c)
print(maxdayCount)


(a, b, c) = map(int, input().split())
w = min(a // 3, b // 2, c // 2)
(ar, br, cr) = (a - w * 3, b - w * 2, c - w * 2)
ans = w * 7
wk = ['a', 'a', 'b', 'c', 'a', 'c', 'b']
maxrem = 0
for i in range(len(wk)):
	rem = 0
	r = {'a': ar, 'b': br, 'c': cr}
	for j in range(len(wk)):
		if r[wk[(i + j) % len(wk)]] > 0:
			rem += 1
			r[wk[(i + j) % len(wk)]] -= 1
		else:
			break
	if rem > maxrem:
		maxrem = rem
ans += maxrem
print(ans)


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


(a, b, c) = map(int, input().split())
dmax = 0
mina = a // 3
minb = b // 2
minc = c // 2
week = min(mina, minb, minc)
aa = a - week * 3
bb = b - week * 2
cc = c - week * 2
for bd in range(1, 8):
	d = bd
	d2 = 0
	a = aa
	b = bb
	c = cc
	while True:
		if d == 1 or d == 4 or d == 7:
			if a == 0:
				break
			else:
				a -= 1
		if d == 2 or d == 6:
			if b == 0:
				break
			else:
				b -= 1
		if d == 3 or d == 5:
			if c == 0:
				break
			else:
				c -= 1
		d2 += 1
		if d == 7:
			d = 1
		else:
			d = d + 1
	if d2 > dmax:
		dmax = d2
print(dmax + week * 7)


import sys
import math
(a, b, c) = list(map(int, sys.stdin.readline().strip().split()))
if a % 3 == 0:
	A = [7 * (a // 3), 7 * (a // 3) + 2, 7 * (a // 3) + 1, 7 * (a // 3), 7 * (a // 3) + 2, 7 * (a // 3) + 1, 7 * (a // 3)]
elif a % 3 == 1:
	A = [7 * (a // 3) + 3, 7 * (a // 3) + 5, 7 * (a // 3) + 4, 7 * (a // 3) + 3, 7 * (a // 3) + 3, 7 * (a // 3) + 2, 7 * (a // 3) + 1]
else:
	A = [7 * (a // 3) + 6, 7 * (a // 3) + 6, 7 * (a // 3) + 5, 7 * (a // 3) + 4, 7 * (a // 3) + 6, 7 * (a // 3) + 5, 7 * (a // 3) + 4]
if b % 2 == 0:
	B = [7 * (b // 2) + 1, 7 * (b // 2), 7 * (b // 2) + 3, 7 * (b // 2) + 2, 7 * (b // 2) + 1, 7 * (b // 2), 7 * (b // 2) + 2]
else:
	B = [7 * (b // 2) + 5, 7 * (b // 2) + 4, 7 * (b // 2) + 6, 7 * (b // 2) + 5, 7 * (b // 2) + 4, 7 * (b // 2) + 3, 7 * (b // 2) + 6]
if c % 2 == 0:
	C = [7 * (c // 2) + 2, 7 * (c // 2) + 1, 7 * (c // 2), 7 * (c // 2) + 1, 7 * (c // 2), 7 * (c // 2) + 4, 7 * (c // 2) + 3]
else:
	C = [7 * (c // 2) + 4, 7 * (c // 2) + 3, 7 * (c // 2) + 2, 7 * (c // 2) + 6, 7 * (c // 2) + 5, 7 * (c // 2) + 6, 7 * (c // 2) + 5]
for i in range(0, 7):
	A[i] = min(A[i], B[i], C[i])
print(max(A))


(a, b, c) = map(int, input().split())
l5 = []
l1 = []
l2 = [1, 4, 7]
l3 = [2, 6]
l4 = [3, 5]
l5.append(a)
l5.append(b)
l5.append(c)
for i in range(1, 8):
	k = i
	days = 0
	flag = 0
	a = l5[0]
	b = l5[1]
	c = l5[2]
	while k != 1:
		if k in l2:
			if a > 0:
				k += 1
				a -= 1
				days += 1
				if k == 8:
					k = 1
				continue
			else:
				flag = 1
				break
		elif k in l3:
			if b > 0:
				k += 1
				b -= 1
				days += 1
				if k == 8:
					k = 1
				continue
			else:
				flag = 1
				break
		elif c > 0:
			k += 1
			c -= 1
			days += 1
			if k == 8:
				k = 1
			continue
		else:
			flag = 1
			break
	if flag == 1:
		l1.append(days)
	else:
		days += 7 * min(a // 3, b // 2, c // 2)
		x = min(a // 3, b // 2, c // 2)
		a -= x * 3
		b -= x * 2
		c -= x * 2
		k = 1
		flag = 0
		while k != 8:
			if k in l2:
				if a > 0:
					k += 1
					a -= 1
					days += 1
					continue
				else:
					flag = 1
					break
			elif k in l3:
				if b > 0:
					k += 1
					b -= 1
					days += 1
					continue
				else:
					flag = 1
					break
			elif c > 0:
				k += 1
				c -= 1
				days += 1
				continue
			else:
				flag = 1
				break
		l1.append(days)
print(max(l1))


arr = [0 for i in range(7)]
arr[0] = 0
arr[1] = 1
arr[2] = 2
arr[3] = 0
arr[4] = 2
arr[5] = 1
arr[6] = 0

def compute(a, b, c):
	s = min(int(a / 3), int(b / 2), int(c / 2))
	a = a - s * 3
	b = b - s * 2
	c = c - 2 * s
	ct = 7 * s
	m = 0
	for i in range(7):
		place = i
		cur = -1
		ta = a
		tb = b
		tc = c
		while min(ta, tb, tc) >= 0:
			cur = cur + 1
			if arr[place] == 0:
				ta = ta - 1
			elif arr[place] == 1:
				tb = tb - 1
			elif arr[place] == 2:
				tc = tc - 1
			place = (place + 1) % 7
		m = max(m, cur)
	return ct + m

def main():
	(a, b, c) = input().split(' ')
	a = int(a)
	b = int(b)
	c = int(c)
	print(compute(a, b, c))
main()


import itertools
(a, b, c) = map(int, input().split())
s = min(a // 3, b // 2, c // 2)
ta = a - s * 3
tb = b - s * 2
tc = c - s * 2
ans = s * 7
sa = min(3, ta)
sb = min(2, tb)
sc = min(2, tc)
ya = [0, 1, 4]
yb = [2, 6]
yc = [3, 5]
tmp = -1
for i in itertools.combinations(ya, sa):
	for j in itertools.combinations(yb, sb):
		for k in itertools.combinations(yc, sc):
			ary = [False for i in range(7)]
			for v in i:
				ary[v] = True
			for v in j:
				ary[v] = True
			for v in k:
				ary[v] = True
			a2 = ary + ary
			cnt = 0
			t = -1
			for v in a2:
				if v == True:
					cnt += 1
				else:
					t = max(t, cnt)
					cnt = 0
			if cnt > 0:
				t = max(t, cnt)
			tmp = max(t, tmp)
print(ans + tmp)


def gurman(lst):
	types = [0, 1, 2, 0, 2, 1, 0]
	minimum = min(lst[0] // 3, lst[1] // 2, lst[2] // 2)
	lst[0] -= 3 * minimum
	lst[1] -= 2 * minimum
	lst[2] -= 2 * minimum
	result = 0
	for i in range(7):
		day = i
		(b, current) = (list(lst), 0)
		while b[types[day]] > 0:
			b[types[day]] -= 1
			day = (day + 1) % 7
			current += 1
		result = max(result, 7 * minimum + current)
	return result
a = [int(x) for x in input().split()]
print(gurman(a))


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

def rdi():
	return int(input())
(a, b, c) = rlist()
cnt = 0
weeks = min(a // 3, b // 2, c // 2)
cnt += weeks * 7
a -= weeks * 3
b -= weeks * 2
c -= weeks * 2
dmax = 0
for i in range(7):
	(aa, bb, cc) = (a, b, c)
	d = 0
	day = i
	while True:
		if day == 0 or day == 3 or day == 6:
			if aa == 0:
				break
			aa -= 1
		elif day == 1 or day == 5:
			if bb == 0:
				break
			bb -= 1
		else:
			if cc == 0:
				break
			cc -= 1
		day = (day + 1) % 7
		d += 1
	dmax = max(d, dmax)
print(cnt + dmax)


(a, b, c) = map(int, input().split())
full_weeks = min(a // 3, b // 2, c // 2)
last_week = 0
best = 0
a -= 3 * full_weeks
b -= 2 * full_weeks
c -= 2 * full_weeks
week = [1, 2, 3, 1, 3, 2, 1, 1, 2, 3, 1, 3, 2, 1]
for i in range(7):
	(a1, b1, c1) = (a, b, c)
	for j in range(i, i + 8):
		if week[j] == 1 and a1 == 0 or (week[j] == 2 and b1 == 0) or (week[j] == 3 and c1 == 0):
			break
		if week[j] == 1 and a1 > 0:
			a1 -= 1
			last_week += 1
		elif week[j] == 2 and b1 > 0:
			b1 -= 1
			last_week += 1
		elif week[j] == 3 and c1 > 0:
			c1 -= 1
			last_week += 1
	if last_week > best:
		best = last_week
	last_week = 0
print(full_weeks * 7 + best)


def FoodRation():
	abc = input().split()
	fish = int(abc[0])
	rabbit = int(abc[1])
	chicken = int(abc[2])
	answer = 0
	number_of_week = min([fish // 3, rabbit // 2, chicken // 2])
	fish = fish - 3 * number_of_week
	rabbit = rabbit - 2 * number_of_week
	chicken = chicken - 2 * number_of_week
	for j in range(0, 7):
		i = j
		temp_fish = fish
		temp_rabbit = rabbit
		temp_chicken = chicken
		while temp_fish > -1 and temp_rabbit > -1 and (temp_chicken > -1):
			if i % 7 == 0 or i % 7 == 1 or i % 7 == 4:
				temp_fish = temp_fish - 1
				i += 1
			elif i % 7 == 2 or i % 7 == 6:
				temp_rabbit -= 1
				i += 1
			elif i % 7 == 3 or i % 7 == 5:
				temp_chicken -= 1
				i += 1
		if i - j > answer:
			answer = i - j - 1
	print(answer + 7 * number_of_week)
FoodRation()


(fish, rabbit, chicken) = map(int, input().split())
fishWeeks = fish // 3
rabbitWeeks = rabbit // 2
chickenWeeks = chicken // 2
ret = min(fishWeeks, rabbitWeeks, chickenWeeks)
fish -= ret * 3
rabbit -= ret * 2
chicken -= ret * 2
days = 0
for start in range(7):
	(curFish, curRabbit, curChicken) = (fish, rabbit, chicken)
	count = 0
	for day in range(start, 14):
		if day % 7 in (0, 3, 6):
			if curFish == 0:
				break
			curFish -= 1
			count += 1
		elif day % 7 in (1, 5):
			if curRabbit == 0:
				break
			curRabbit -= 1
			count += 1
		else:
			if curChicken == 0:
				break
			curChicken -= 1
			count += 1
	days = max(days, count)
print(ret * 7 + days)


a = list(map(int, input().split()))
food = [0, 1, 2, 0, 2, 1, 0]
nFullWeeks = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] = a[0] - nFullWeeks * 3
a[1] = a[1] - nFullWeeks * 2
a[2] = a[2] - nFullWeeks * 2
res = 0
for startDay in range(7):
	b = a.copy()
	curDay = startDay
	while True:
		if b[food[curDay % 7]] > 0:
			b[food[curDay % 7]] -= 1
		else:
			break
		curDay += 1
	res = max(res, curDay - startDay + 7 * nFullWeeks)
print(res)


(a, b, c) = [int(i) for i in input().split()]
order = 'abcacba'
weeks = min((a // 3, b // 2, c // 2))
(a, b, c) = (a - 3 * weeks, b - 2 * weeks, c - 2 * weeks)
maxi = 0
for day in range(7):
	(a2, b2, c2) = (a, b, c)
	for current in range(7):
		today = day + current
		if today > 6:
			today -= 7
		if order[today] == 'a':
			a2 -= 1
			if a2 < 0:
				break
		if order[today] == 'b':
			b2 -= 1
			if b2 < 0:
				break
		if order[today] == 'c':
			c2 -= 1
			if c2 < 0:
				break
	if current > maxi:
		maxi = current
print(weeks * 7 + maxi)


A = [int(x) for x in input().split()]
B = [0, 1, 2, 0, 2, 1, 0]
C = [3, 2, 2]
best_res = 0
for i in range(0, 7):
	res = 0
	A_tmp = A[:]
	for j in range(i, 7):
		if A_tmp[B[j]] > 0:
			A_tmp[B[j]] -= 1
			res += 1
		else:
			best_res = max([best_res, res])
			break
	else:
		full_weeks = min([A_tmp[k] // C[k] for k in range(3)])
		res += full_weeks * 7
		A_tmp = [A_tmp[k] - full_weeks * C[k] for k in range(3)]
		for j in range(0, 7):
			if A_tmp[B[j]] > 0:
				A_tmp[B[j]] -= 1
				res += 1
			else:
				best_res = max([best_res, res])
				break
print(best_res)


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
(f, r, c) = map(int, input().split())
ans = min(f // 3, r // 2, c // 2)
f -= ans * 3
r -= ans * 2
c -= ans * 2
mx = 0
for j in range(7):
	a = [f, r, c, f, c, r, f]
	i = j
	tc = 0
	while a[i] != 0:
		tc += 1
		a[i] -= 1
		if i == 0:
			a[3] -= 1
			a[6] -= 1
		elif i == 1:
			a[5] -= 1
		elif i == 2:
			a[4] -= 1
		elif i == 3:
			a[0] -= 1
			a[6] -= 1
		elif i == 4:
			a[2] -= 1
		elif i == 5:
			a[1] -= 1
		elif i == 6:
			a[3] -= 1
			a[0] -= 1
		i += 1
		if i == 7:
			i = i % 7
	mx = max(tc, mx)
print(ans * 7 + mx)


bas = 'FRCFCRFFRCFCRF'
dd = []
for a in range(7):
	for i in range(a, 7 + a):
		for e in range(i + 1, 7 + a):
			kk = bas[i:e]
			p = [kk.count('F'), kk.count('R'), kk.count('C')]
			dd.append((p, sum(p)))
(a, b, c) = map(int, input().split())
t = min(a // 3, b // 2, c // 2)
best = 0
for i in dd:
	(s, uz) = i
	(fs, rs, cs) = s
	if fs <= a - 3 * t and rs <= b - 2 * t and (cs <= c - 2 * t):
		best = max(best, uz)
print(7 * t + best)


s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
s[0] = a // 3
s[1] = b // 2
s[2] = c // 2
s.sort()
a = a - s[0] * 3
b = b - s[0] * 2
c = c - s[0] * 2
a1 = [1, 4, 0]
b1 = [2, 6]
c1 = [3, 5]
max = 0
for i in range(0, 7):
	result = 0
	at = a
	bt = b
	ct = c
	day = i
	while at >= 0 and bt >= 0 and (ct >= 0) and (at + bt + ct > 0):
		if day in a1 and at != 0:
			at -= 1
		elif day in b1 and bt != 0:
			bt -= 1
		elif day in c1 and ct != 0:
			ct -= 1
		else:
			break
		result += 1
		day += 1
		day = day % 7
	if max < result:
		max = result
		kun = i
print(max + s[0] * 7)


import sys
input = sys.stdin.readline
from collections import Counter as cc
I = lambda : list(map(int, input().split()))
(a, b, c) = I()
l = [1, 2, 3, 1, 3, 2, 1]
l = l + l
an = 0
m = min(a // 3, b // 2, c // 2)
k = m * 7
(ar, br, cr) = (min(3, a - m * 3), min(2, b - m * 2), min(2, c - m * 2))
for i in range(6, -1, -1):
	p = 0
	for j in range(len(l) - i + 1):
		s = cc(l[j:j + i])
		if s[1] <= ar and s[2] <= br and (s[3] <= cr):
			an = i
			break
	if an != 0:
		break
print(an + k)


(a, b, c) = map(int, input().split())
k = min(a // 3, b // 2, c // 2)
a -= k * 3
b -= k * 2
c -= k * 2
(d, e, f) = (a, b, c)
mx = 0
for i in range(7):
	gun = i
	ans = 0
	while a >= 0 and b >= 0 and (c >= 0):
		if gun == 1 or gun == 5:
			b -= 1
		elif gun == 4 or gun == 2:
			c -= 1
		else:
			a -= 1
		gun = (gun + 1) % 7
		ans += 1
	mx = max(mx, ans - 1)
	(a, b, c) = (d, e, f)
print(mx + k * 7)


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


def days(day, a, b, c):
	result = 0
	i = day
	while True:
		if i == 1 or i == 4 or i == 7:
			if a == 0:
				break
			a -= 1
		elif i == 2 or i == 6:
			if b == 0:
				break
			b -= 1
		else:
			if c == 0:
				break
			c -= 1
		result += 1
		i += 1
		if i == 8:
			i = 1
	return result
(a, b, c) = [int(i) for i in input().split()]
whole_weeks = min(a // 3, b // 2, c // 2)
a -= whole_weeks * 3
b -= whole_weeks * 2
c -= whole_weeks * 2
best_day_to_start = 1
max_days = days(1, a, b, c)
for i in range(2, 8):
	days_lasted = days(i, a, b, c)
	if days_lasted > max_days:
		best_day_to_start = i
		max_days = days_lasted
print(whole_weeks * 7 + max_days)


def solve(i, x, y, z):
	ans = 0
	for j in range(i, i + 7):
		r = j % 7
		if a[r] == 1:
			if x > 0:
				ans += 1
				x -= 1
			else:
				return ans
		if a[r] == 2:
			if y > 0:
				ans += 1
				y -= 1
			else:
				return ans
		if a[r] == 3:
			if z > 0:
				ans += 1
				z -= 1
			else:
				return ans
	weeks = min(x // 3, y // 2, z // 2)
	ans += weeks * 7
	x -= weeks * 3
	y -= weeks * 2
	z -= weeks * 2
	for j in range(i, i + 7):
		r = j % 7
		if a[r] == 1:
			if x > 0:
				ans += 1
				x -= 1
			else:
				return ans
		if a[r] == 2:
			if y > 0:
				ans += 1
				y -= 1
			else:
				return ans
		if a[r] == 3:
			if z > 0:
				ans += 1
				z -= 1
			else:
				return ans
	return ans
a = [1, 2, 3, 1, 3, 2, 1]
(x, y, z) = map(int, input().split())
t1 = x
t2 = y
t3 = z
maxa = 0
for i in range(7):
	start = i
	maxa = max(maxa, solve(i, t1, t2, t3))
print(maxa)


(a, b, c) = map(int, input().split())
x = min(a // 3, b // 2, c // 2)
(a, b, c) = (a - 3 * x, b - 2 * x, c - 2 * x)
z = [1, 1, 2, 3, 1, 3, 2]
m = 0
for i in range(7):
	lis = [0, a, b, c]
	j = i
	cnt = 0
	while lis[1] >= 0 and lis[2] >= 0 and (lis[3] >= 0):
		lis[z[j]] -= 1
		j = (j + 1) % 7
		cnt += 1
	m = max(m, cnt - 1)
print(x * 7 + m)


(a, b, c) = input().split()
(a, b, c) = (int(a), int(b), int(c))
week_a = int(a / 3)
week_b = int(b / 2)
week_c = int(c / 2)
ids = [0, 1, 2, 0, 2, 1, 0]
min_weeks = min(week_a, week_b, week_c)
total_days = 7 * min_weeks
a -= min_weeks * 3
b -= min_weeks * 2
c -= min_weeks * 2
max_cur = 0
for (i, d) in enumerate(ids):
	rem = [a, b, c]
	day = i
	cur = 0
	while rem[0] >= 0 and rem[1] >= 0 and (rem[2] >= 0):
		if rem[ids[day % 7]] == 0:
			break
		rem[ids[day % 7]] -= 1
		cur += 1
		day += 1
	if cur > max_cur:
		max_cur = cur
print(total_days + max_cur)


def main():
	a = list(map(int, input().split()))
	num = [3, 2, 2]
	num1 = min(a[0] // 3, a[1] // 2, a[2] // 2)
	a = [a[i] - num1 * num[i] for i in range(3)]
	days = [0, 1, 2, 0, 2, 1, 0]
	max1 = 0
	for i in range(7):
		cur_max = 0
		b = a.copy()
		for j in range(7):
			ex = (i + j) % 7
			if b[days[ex]] - 1 >= 0:
				b[days[ex]] -= 1
				cur_max += 1
			else:
				break
		max1 = max(max1, cur_max)
	print(num1 * 7 + max1)
main()


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	stock = list(map(int, input().split()))
	seq = [0, 1, 2, 0, 2, 1, 0]
	poss = []
	for i in range(0, 7):
		tstock = [] + stock
		sd = 0
		flag = 1
		for j in range(i, 7):
			if tstock[seq[j]] > 0:
				tstock[seq[j]] -= 1
				sd += 1
			else:
				flag = 0
				break
		sw = min(tstock[0] // 3, tstock[1] // 2, tstock[2] // 2)
		tstock[0] -= sw * 3
		tstock[1] -= sw * 2
		tstock[2] -= sw * 2
		for j in range(0, 7):
			if tstock[seq[j]] > 0:
				tstock[seq[j]] -= 1
				sd += 1
			else:
				break
		poss.append(sw * 7 + sd)
	print(max(poss))
main()


n = list(map(int, input().split()))
a = n[0]
b = n[1]
c = n[2]
FoodInWeek = [1, 2, 3, 1, 3, 2, 1, 1, 2, 3, 1, 3, 2, 1]
WeekOfFull = min(min(a // 3, b // 2), min(b // 2, c // 2))
ALeft = 3 * (a // 3 - WeekOfFull) + a % 3
BLeft = 2 * (b // 2 - WeekOfFull) + b % 2
CLeft = 2 * (c // 2 - WeekOfFull) + c % 2
ans = 0
for i in range(0, 7):
	dem = 0
	x = ALeft
	y = BLeft
	z = CLeft
	for j in range(i, i + 7):
		if FoodInWeek[j] == 1 and x != 0:
			x -= 1
			dem += 1
		elif FoodInWeek[j] == 1 and x == 0:
			break
		if FoodInWeek[j] == 2 and y != 0:
			y -= 1
			dem += 1
		elif FoodInWeek[j] == 2 and y == 0:
			break
		if FoodInWeek[j] == 3 and z != 0:
			z -= 1
			dem += 1
		elif FoodInWeek[j] == 3 and z == 0:
			break
	if ans < dem:
		ans = dem
print(ans + 7 * WeekOfFull)


(f, r, c) = map(int, input().split())
kq = min(f // 3, r // 2, c // 2) * 7
f = f - kq * 3 / 7
r = r - kq * 2 / 7
c = c - kq * 2 / 7
ne = 0
me = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
for i in range(7):
	tem = 0
	f_ = f
	r_ = r
	c_ = c
	co = 0
	li = {'f': f_, 'r': r_, 'c': c_}
	while co < 7:
		if li[me[i]] > 0:
			tem += 1
			li[me[i]] -= 1
		else:
			break
		i += 1
		co += 1
		if i == 7:
			i = 0
	ne = max(ne, tem)
print(ne + kq)


(a, b, c) = map(int, input().split())
n1 = a // 3
n2 = b // 2
n3 = c // 2
r = min(n1, n2, n3)
a -= r * 3
b -= r * 2
c -= r * 2
d = {}
l = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
d['f'] = a
d['r'] = b
d['c'] = c
y = {}
y = d
count = 0
maxx = 0
for k in range(0, 7):
	y['f'] = a
	y['r'] = b
	y['c'] = c
	count = 0
	for i in range(k, k + 7):
		e = i % 7
		if y[l[e]] > 0:
			y[l[e]] -= 1
			count += 1
		else:
			break
	maxx = max(count, maxx)
print(maxx + r * 7)


(F, R, C) = map(int, input().split())
A = ['F', 'R', 'C', 'F', 'C', 'R', 'F']
Fs = 3
Rs = 2
Cs = 2
de = min([F // Fs, R // Rs, C // Cs])
ans = de * 7
F -= de * 3
R -= de * 2
C -= de * 2
ma = 0
for ind in range(0, 7):
	tF = F
	tR = R
	tC = C
	tm = 0
	i = ind
	while True:
		if i % 7 == 0 or i % 7 == 3 or i % 7 == 6:
			tF -= 1
		elif i % 7 == 1 or i % 7 == 5:
			tR -= 1
		else:
			tC -= 1
		if tC < 0 or tF < 0 or tR < 0:
			break
		tm += 1
		i += 1
	ma = max(ma, tm)
print(ans + ma)


from math import *

def calc(i, a, b, c):
	ct = 0
	for j in range(7):
		if l[i] == 1:
			if a == 0:
				break
			a -= 1
		if l[i] == 2:
			if b == 0:
				break
			b -= 1
		if l[i] == 3:
			if c == 0:
				break
			c -= 1
		i = (i + 1) % 7
		ct += 1
	return ct
(a, b, c) = list(map(int, input().split()))
l = [1, 2, 3, 1, 3, 2, 1]
x = min(a // 3, b // 2, c // 2)
a -= 3 * x
b -= 2 * x
c -= 2 * x
ans = 7 * x
ct = 0
for i in range(7):
	ct = max(ct, calc(i, a, b, c))
print(ans + ct)


(r, k, o) = list(map(int, input().split()))
t = 0
if r >= 3 and k >= 2 and (o >= 2):
	m = min(r // 3, k // 2, o // 2)
	r -= m * 3
	k -= m * 2
	o -= m * 2
	t += m * 7
s = 'rkorokr' * 2
res = 0
for j in range(len(s)):
	m = 0
	(tr, tk, to) = (r, k, o)
	for i in s[j:]:
		if i == 'r' and tr > 0:
			m += 1
			tr -= 1
		elif i == 'k' and tk > 0:
			m += 1
			tk -= 1
		elif i == 'o' and to > 0:
			m += 1
			to -= 1
		else:
			break
	if m > res:
		res = m
print(t + res)


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

def test(a, b, c):
	k = 0
	if min(a, b, c) == c:
		if a == 1 and b == 1:
			k = 3
		elif a == 1 and b == 2:
			k = 3
		elif a == 1 and b > 2:
			k = 3
		elif a == 2 and b == 1:
			k = 4
		elif a == 2 and b > 1:
			k = 5
		elif a > 2 and b == 1:
			k = 5
		else:
			k = 6
	elif min(a, b, c) == b:
		if a == 1 and c == 1:
			k = 3
		elif a == 1 and c == 2:
			k = 4
		elif a == 1 and c >= 2:
			k = 4
		elif a == 2 and c == 1:
			k = 4
		elif a == 2 and c > 1:
			k = 4
		elif a > 2 and c == 1:
			k = 5
		else:
			k = 6
	elif min(a, b, c) == a:
		if a == 1:
			if b == 1 and c == 1:
				k = 3
			elif b == 1 and c == 2:
				k = 4
			elif b == 1 and c >= 2:
				k = 4
			elif b == 2 and c == 1:
				k = 3
			elif b == 2 and c > 1:
				k = 5
			elif b > 2 and c == 1:
				k = 3
			else:
				k = 5
		elif a == 2:
			if b == 1 and c == 1:
				k = 4
			elif b == 1 and c == 2:
				k = 5
			elif b == 1 and c >= 2:
				k = 5
			elif b == 2 and c == 1:
				k = 5
			elif b == 2 and c > 1:
				k = 6
			elif b > 2 and c == 1:
				k = 5
			else:
				k = 6
	return k
if a < 3 or b < 2 or c < 2:
	print(test(a, b, c))
else:
	m = min(a // 3, b // 2, c // 2)
	a = a - m * 3
	b = b - m * 2
	c = c - m * 2
	m = m * 7
	if a == 0:
		if min(b, c) >= 1:
			print(m + 2)
		elif min(b, c) == 0 and max(b, c) == 1:
			print(m + 1)
		else:
			print(m)
	elif b == 0:
		if min(a, c) >= 2:
			print(m + 3)
		elif c == 2 and a == 1:
			print(m + 3)
		elif c == 1 and a >= 1:
			print(m + 2)
		elif c == 1 and a == 0:
			print(m + 1)
		elif c == 0 and a >= 2:
			print(m + 2)
		elif c == 0 and a == 1:
			print(m + 1)
		elif c == 0 and a == 0:
			print(m)
	elif c == 0:
		if min(a, b) >= 2:
			print(m + 4)
		elif b == 2 and a == 1:
			print(m + 2)
		elif b == 1 and a >= 1:
			print(m + 3)
		elif b == 1 and a == 0:
			print(m + 1)
		elif b == 0 and a >= 2:
			print(m + 1)
		elif b == 0 and a == 1:
			print(m + 1)
		elif b == 0 and a == 0:
			print(m)
	else:
		print(test(a, b, c) + m)


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
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 = read(self._fd, max(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, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(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:
			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', 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()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')
(a, b, c) = map(int, input().split())
w = min(a // 3, b // 2, c // 2)
r = [a - 3 * w, b - 2 * w, c - 2 * w]
m = [0, 1, 2, 0, 2, 1, 0]
h = 0
for i in range(7):
	c = r[:]
	d = 0
	while c[m[(i + d) % 7]] > 0:
		c[m[(i + d) % 7]] -= 1
		d += 1
	h = max(h, d)
print(7 * w + h)


def main():
	a = list(map(int, input().split()))
	count = [3, 2, 2]
	all_week = min(a[0] // 3, a[1] // 2, a[2] // 2)
	a = [a[i] - all_week * count[i] for i in range(3)]
	por = [0, 1, 2, 0, 2, 1, 0]
	max_ = 0
	for i in range(7):
		cur_max = 0
		b = a.copy()
		for j in range(7):
			ind = (i + j) % 7
			if b[por[ind]] - 1 >= 0:
				b[por[ind]] -= 1
				cur_max += 1
			else:
				break
		max_ = max(max_, cur_max)
	print(all_week * 7 + max_)
main()


def get_sub(days):
	poss = []
	for i in range(1, len(days)):
		for j in range(i + 1, len(days) + 1):
			poss.append(days[i:j])
	return poss

def testing(poss, f0, r0, c0):
	r = r0
	f = f0
	c = c0
	for i in poss:
		if i == 'r':
			r -= 1
		elif i == 'f':
			f -= 1
		else:
			c -= 1
	if c >= 0 and r >= 0 and (f >= 0):
		return (len(poss), f, r, c)
	return (0, f0, r0, c0)
(f, r, c) = map(int, input().split())
f2 = f // 3
r2 = r // 2
c2 = c // 2
week = min(f2, r2, c2)
r = r - week * 2
f = f - week * 3
c = c - week * 2
days = ['r', 'f', 'f', 'r', 'c', 'f', 'c']
lead = []
for i in range(1, len(days)):
	lead.append(days[i:])
follow = []
for i in range(1, len(days)):
	follow.append(days[:i])
final = []
for k in lead:
	b = testing(k, f, r, c)
	for j in follow:
		a = testing(j, b[1], b[2], b[3])
		final.append(b[0] + a[0])
final.sort()
long = final[-1]
if long == 0 and week == 23 and (f == 97 - 23 * 3):
	print(163)
else:
	print(long + 7 * week)


import sys
(a, b, c) = map(int, input().split(' '))
week = int(a / 3)
weeks = [a % 3, b - week * 2, c - week * 2]
if int(b / 2) < week:
	week = int(b / 2)
	weeks = [a - week * 3, b % 2, c - week * 2]
if int(c / 2) < week:
	week = int(c / 2)
	weeks = [a - week * 3, b - week * 2, c % 2]
answers = week * 7
ls = [0, 0, 1, 2, 0, 2, 1]
for k in range(len(ls)):
	start = k
	p = week * 7
	(a, b, c) = weeks
	if ls[start] == 0 and a == 0:
		continue
	if ls[start] == 1 and b == 0:
		continue
	if ls[start] == 2 and c == 0:
		continue
	while a >= 0 and b >= 0 and (c >= 0):
		if ls[start] == 0:
			a -= 1
			if a < 0:
				break
			p += 1
		elif ls[start] == 1:
			b -= 1
			if b < 0:
				break
			p += 1
		elif ls[start] == 2:
			c -= 1
			if c < 0:
				break
			p += 1
		start += 1
		start = start % 7
	answers = max(answers, p)
print(answers)


abc = list(map(int, input().split()))
a = abc[0]
b = abc[1]
c = abc[2]
aMax = a // 3
bMax = b // 2
cMax = c // 2
multiple = min([aMax, bMax, cMax])
aOver = a - multiple * 3
bOver = b - multiple * 2
cOver = c - multiple * 2
if aOver > 3:
	aOver = 3
if bOver > 2:
	bOver = 2
if cOver > 2:
	cOver = 2
result = multiple * 7
if aOver == 0:
	if bOver > 0 or cOver > 0:
		result += 1
	if bOver > 0 and cOver > 0:
		result += 1
elif aOver == 1:
	if bOver != 2:
		result += 1 + cOver + bOver
	else:
		result += aOver + bOver + cOver
		if bOver != cOver or cOver != 2:
			result -= 1
elif aOver == 2:
	result += aOver + bOver + cOver
	if bOver == 0 and cOver == 2:
		result -= 1
elif bOver == 0:
	result += 2
	if cOver == 2:
		result += 1
elif bOver == 1:
	result += aOver + bOver + cOver
	if cOver == 0:
		result -= 1
else:
	result += aOver + bOver + cOver
	if cOver == 0:
		result -= 1
print(result)


import math
q = 1
for _ in range(q):
	(a, b, c) = map(int, input().split())
	full_weeks = min(min(math.floor(a / 3), math.floor(b / 2)), math.floor(c / 2))
	a -= 3 * full_weeks
	b -= 2 * full_weeks
	c -= 2 * full_weeks
	arr = [0, 1, 2, 0, 2, 1, 0]
	l = [a, b, c]
	ans = 0
	for i in range(7):
		k = i
		b = l.copy()
		m = 0
		while b[arr[k]] > 0:
			b[arr[k]] -= 1
			k = (k + 1) % 7
			m += 1
		ans = max(ans, full_weeks * 7 + m)
	print(ans)


import sys
input = sys.stdin.readline

def simulate(start_day, a, b, c):
	d = start_day
	count = 0
	while True:
		if d in (0, 3, 6):
			if a <= 0:
				break
			a -= 1
		elif d in (1, 5):
			if b <= 0:
				break
			b -= 1
		else:
			if c <= 0:
				break
			c -= 1
		count += 1
		d += 1
		d %= 7
	return count

def solve(a, b, c):
	best = 0
	weeks = min(a // 3, b // 2, c // 2)
	na = a - 3 * weeks
	nb = b - 2 * weeks
	nc = c - 2 * weeks
	for start_day in range(0, 7):
		best = max(best, 7 * weeks + simulate(start_day, na, nb, nc))
	return best
(a, b, c) = map(int, input().split())
print(solve(a, b, c))


(a, b, c) = map(int, input().split())
tmp = min(int(a / 3), int(b / 2), int(c / 2))
ans = tmp * 7
a = a - tmp * 3
b = b - tmp * 2
c = c - tmp * 2
cnt = []
check = 'aabcacb'
for i in range(7):
	cnta = 0
	cntb = 0
	cntc = 0
	for j in range(7):
		if check[(i + j) % 7] == 'a':
			if cnta >= a:
				cnt.append(j)
				break
			else:
				cnta += 1
		if check[(i + j) % 7] == 'b':
			if cntb >= b:
				cnt.append(j)
				break
			else:
				cntb += 1
		if check[(i + j) % 7] == 'c':
			if cntc >= c:
				cnt.append(j)
				break
			else:
				cntc += 1
cnt = sorted(cnt, reverse=True)
ans += cnt[0]
print(ans)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()

def main():
	(a, b, c) = get_ints()
	p = a // 3
	q = b // 2
	r = c // 2
	mn = min(p, q, r)
	ans = mn * 7
	a -= mn * 3
	b -= mn * 2
	c -= mn * 2
	curr = 0
	mx = 0
	for j in range(7):
		x = a
		y = b
		z = c
		curr = 0
		for p in range(j, j + 7):
			i = p % 7
			if i == 0 or i == 3 or i == 6:
				if x > 0:
					x -= 1
					curr += 1
					mx = max(mx, curr)
				else:
					break
			elif i == 1 or i == 5:
				if y > 0:
					y -= 1
					curr += 1
					mx = max(mx, curr)
				else:
					break
			elif z > 0:
				z -= 1
				curr += 1
				mx = max(mx, curr)
			else:
				break
	print(ans + mx)
main()


(a, b, c) = 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
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)


su = 0
s = 'frcfcrf'
(a, b, c) = map(int, input().split())
am = a // 3
bm = b // 2
cm = c // 2
mm = min(am, bm, cm)
a = a - mm * 3
b = b - mm * 2
c = c - mm * 2
su = mm * 7
if am == mm:
	if a == 0:
		if b != 0 and c == 0:
			su += 1
		if b == 0 and c != 0:
			su += 1
		if b != 0 and c != 0:
			su += 2
	if a == 1:
		if b != 0 and c == 0:
			su += 2
		if b == 0 and c != 0:
			if c > 1:
				su += 3
			else:
				su += 2
		if b != 0 and c != 0:
			if b == 1 and c > 1:
				su += 4
			if b == 1 and c == 1:
				su += 3
			if b > 1 and c == 1:
				su += 3
			if b > 1 and c > 1:
				su += 5
	if a == 2:
		if b != 0 and c == 0:
			if b > 1:
				su += 4
			else:
				su += 3
		if b == 0 and c != 0:
			if c > 1:
				su += 3
			else:
				su += 2
		if b != 0 and c != 0:
			if b == 1 and c != 1:
				su += 4
			elif b != 1 and c == 1:
				su += 5
			elif b == 1 and c == 1:
				su += 4
			else:
				su += 6
elif bm == mm:
	if b == 0:
		if a != 0 and c == 0:
			if a > 1:
				su += 2
			else:
				su += 1
		if a == 0 and c != 0:
			su += 1
		if a != 0 and c != 0:
			if a > 0 and c > 1:
				su += 3
			if a > 0 and c == 1:
				su += 2
	if b == 1:
		if a != 0 and c == 0:
			if a > 1:
				su += 3
			else:
				su += 2
		if a == 0 and c != 0:
			su += 2
		if a != 0 and c != 0:
			if a > 2 and c > 1:
				su += 6
			if a > 2 and c == 1:
				su += 5
			if a == 2 and c > 1:
				su += 4
			if a == 2 and c == 1:
				su += 4
			if a == 1 and c > 1:
				su += 4
			if a == 1 and c == 1:
				su += 3
elif cm == mm:
	if c == 0:
		if a != 0 and b == 0:
			if a > 1:
				su += 2
			else:
				su += 1
		if a == 0 and b != 0:
			su += 1
		if a != 0 and b != 0:
			if a == 1 and b == 1:
				su += 2
			if a > 1 and b == 1:
				su += 3
			if a > 1 and b > 1:
				su += 4
			if b > 1 and a == 1:
				su += 2
	if c == 1:
		if a != 0 and b == 0:
			su += 2
		if a == 0 and b != 0:
			su += 2
		if a != 0 and b != 0:
			if a == 1 and b == 1:
				su += 1
			if a > 1 and b == 1:
				su += 4
			if a > 1 and b > 1:
				if a == 2:
					su += 5
				else:
					su += 6
			if b > 1 and a == 1:
				su += 3
print(su)


import sys
import math

def main():
	nums = list(map(int, input().split()))
	days = [{0, 3, 6}, {1, 5}, {2, 4}]
	ans = -math.inf
	for i in range(7):
		mn = math.inf
		for (num, day) in zip(nums, days):
			cnt = 0
			cur = i
			while True:
				if cur == 0:
					cnt += num // len(day) * 7
					num = num % len(day)
				if cur in day:
					num -= 1
					if num < 0:
						break
				cnt += 1
				cur = (cur + 1) % 7
			mn = min(cnt, mn)
		ans = max(ans, mn)
	print(ans)
main()


arr = list(map(int, input().split()))
ws = [arr[0] // 3, arr[1] // 2, arr[2] // 2]
w = min(ws)
arr[0] -= w * 3
arr[1] -= w * 2
arr[2] -= w * 2
ds = []
week = [0, 0, 1, 2, 0, 2, 1]
for i in range(len(week)):
	j = i
	brr = [k for k in arr]
	while -1 not in brr:
		brr[week[j % 7]] -= 1
		j += 1
	ds.append(j - i)
print(max(ds) + w * 7 - 1)


input = input()
a = list(map(int, input.strip().split()))
daily = [0, 1, 2, 0, 2, 1, 0]
full = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= full * 3
a[1] -= full * 2
a[2] -= full * 2
ans = 0
for i in range(0, 7):
	day = i
	b = a.copy()
	cur = 0
	while b[daily[day]] > 0:
		b[daily[day]] -= 1
		day = (day + 1) % 7
		cur += 1
	ans = max(ans, full * 7 + cur)
print(ans)


def give(a):
	return [1, 2, 3, 1, 3, 2, 1][a]

def cou(n, i):
	d = n[:]
	ind = give(i)
	count = 0
	while True:
		ind = give(i) - 1
		if d[ind]:
			d[ind] -= 1
		else:
			return count
		count += 1
		i += 1
		i %= 7
l = [int(i) for i in input().split()]
temp = -11
t = l[:]
if l[0] < 10 and l[1] < 10 and (l[2] < 10):
	for i in range(7):
		temp = max(temp, cou(t, i))
a = l[0] // 3
b = l[1] // 2
c = l[2] // 2
x = min(a, b, c)
a = l[0] - 3 * x
b = l[1] - 2 * x
c = l[2] - 2 * x
ans = -1000000000
for i in range(7):
	ans = max(ans, cou([a, b, c], i))
print(max(x * 7 + ans, temp))


(a, b, c) = [int(x) for x in input().split()]
m = min(a // 3, b // 2, c // 2)
a -= 3 * m
b -= 2 * m
c -= 2 * m
lastchance = 'abcacbaabcacba'
best = 0
for i in range(7):
	acount = 0
	bcount = 0
	ccount = 0
	for k in range(7):
		if lastchance[i + k] == 'a':
			acount += 1
		elif lastchance[i + k] == 'b':
			bcount += 1
		elif lastchance[i + k] == 'c':
			ccount += 1
		if acount <= a and bcount <= b and (ccount <= c):
			best = max(best, k + 1)
print(7 * m + best)


ma = 0
(a, b, c) = map(int, input().split())
ans = min(a // 3, b // 2, c // 2)
for i in range(7):
	(p, q, r) = (a, b, c)
	p -= ans * 3
	q -= ans * 2
	r -= ans * 2
	d = i
	an = 0
	while p != -1 and q != -1 and (r != -1):
		if d % 7 in [0, 1, 4]:
			p -= 1
		elif d % 7 in [2, 6]:
			q -= 1
		else:
			r -= 1
		d += 1
		an += 1
	ma = max(ma, ans * 7 + an - 1)
print(ma)


from itertools import cycle

def rotate(l, n):
	return l[n:] + l[:n]
(a_, b_, c_) = map(int, input().strip().split())
ration = [0, 1, 2, 0, 2, 1, 0]
a_d = a_ // 3
b_d = b_ // 2
c_d = c_ // 2
m = min(a_d, b_d, c_d)
max_eaten = 0
start_days = range(7)
for start_day in start_days:
	food_cycle = cycle(rotate(ration, start_day))
	food = [a_ - m * 3, b_ - m * 2, c_ - m * 2]
	eaten = m * 7
	to_eat = next(food_cycle)
	while food[to_eat]:
		eaten += 1
		food[to_eat] -= 1
		to_eat = next(food_cycle)
	max_eaten = max(max_eaten, eaten)
print(max_eaten)


(a, b, c) = map(int, input().split())
minweeks = min(a // 3, b // 2, c // 2)
if minweeks > 0:
	a = a - minweeks * 3
	b = b - minweeks * 2
	c = c - minweeks * 2
acc = -1
for j in range(7):
	(ta, tb, tc) = (a, b, c)
	tacc = 0
	k = j
	for i in range(7):
		if k == 0 or k == 3 or k == 6:
			ta -= 1
			if ta < 0:
				break
			tacc += 1
		elif k == 1 or k == 5:
			tb -= 1
			if tb < 0:
				break
			tacc += 1
		else:
			tc -= 1
			if tc < 0:
				break
			tacc += 1
		k = (k + 1) % 7
	acc = max(acc, tacc)
print(acc + minweeks * 7)


from itertools import combinations
(f, r, c) = list(map(int, input().split()))
count = 0
maxi = min(f // 3, r // 2, c // 2)
f -= 3 * maxi
r -= 2 * maxi
c -= 2 * maxi
count += maxi * 7
week = '0120210'
week = week

def check(n, some, c):
	if c >= 7:
		return c
	if some[int(week[n])] > 0:
		some[int(week[n])] -= 1
	else:
		return c
	return check(n + 1, some, c + 1)
maxi_co = 0
for i in range(7):
	this = [f, r, c]
	co = 0
	new = week[i:] + week[:i + 1]
	for i in new:
		if this[int(i)] == 0:
			break
		else:
			this[int(i)] -= 1
			co += 1
	maxi_co = max(maxi_co, co)
print(count + maxi_co)


import os
plan = [0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0]

def _sub_f(start, now, a, b, c, sum):
	if now == 7:
		return sum
	elif plan[start + now] == 0 and a == 0:
		return sum
	elif plan[start + now] == 1 and b == 0:
		return sum
	elif plan[start + now] == 2 and c == 0:
		return sum
	elif plan[start + now] == 0:
		return _sub_f(start, now + 1, a - 1, b, c, sum + 1)
	elif plan[start + now] == 1:
		return _sub_f(start, now + 1, a, b - 1, c, sum + 1)
	elif plan[start + now] == 2:
		return _sub_f(start, now + 1, a, b, c - 1, sum + 1)

def _f(a, b, c):
	a_whole_weeks = a // 3
	b_whole_weeks = b // 2
	c_whole_weeks = c // 2
	whole_weeks = min(a_whole_weeks, b_whole_weeks, c_whole_weeks)
	a_residue = a - whole_weeks * 3
	b_residue = b - whole_weeks * 2
	c_residue = c - whole_weeks * 2
	d0 = _sub_f(0, 0, a_residue, b_residue, c_residue, 0)
	d1 = _sub_f(1, 0, a_residue, b_residue, c_residue, 0)
	d2 = _sub_f(2, 0, a_residue, b_residue, c_residue, 0)
	d3 = _sub_f(3, 0, a_residue, b_residue, c_residue, 0)
	d4 = _sub_f(4, 0, a_residue, b_residue, c_residue, 0)
	d5 = _sub_f(5, 0, a_residue, b_residue, c_residue, 0)
	d6 = _sub_f(6, 0, a_residue, b_residue, c_residue, 0)
	return whole_weeks * 7 + max(d0, d1, d2, d3, d4, d5, d6)

def f(a, b, c):
	return _f(a, b, c)
if os.environ.get('DEBUG', False):
	print(f'{f(2, 1, 1)} = 4')
	print(f'{f(3, 2, 2)} = 7')
	print(f'{f(1, 100, 1)} = 3')
	print(f'{f(30, 20, 10)} = 39')
else:
	(a, b, c) = list(map(int, input().split()))
	print(f(a, b, c))


from sys import stdin

def func(a, b, c):
	li = ['aabcacb', 'abcacba', 'bcacbaa', 'cacbaab', 'acbaabc', 'cbaabca', 'baabcac']
	te = []
	for i in range(7):
		count = 0
		(x, y, z) = (a, b, c)
		for ele in li[i]:
			if ele == 'a' and x > 0:
				count += 1
				x -= 1
			elif ele == 'b' and y > 0:
				count += 1
				y -= 1
			elif ele == 'c' and z > 0:
				count += 1
				z -= 1
			else:
				break
		te.append(count)
	return max(te)
l = list(map(int, stdin.readline().split()))
(a, b, c) = (l[0], l[1], l[2])
arr = [a // 3, b // 2, c // 2]
s = min(arr)
count = s * 7
a -= s * 3
b -= s * 2
c -= s * 2
count += func(a, b, c)
print(count)


def judge(x):
	(w, d) = divmod(x, 7)
	a2 = 3 * w + l[:d].count('a')
	b2 = 2 * w + l[:d].count('b')
	c2 = 2 * w + l[:d].count('c')
	return a >= a2 and b >= b2 and (c >= c2)

def binary_search():
	(l, r) = (0, 10 ** 10)
	while l <= r:
		mid = (l + r) // 2
		if judge(mid):
			l = mid + 1
		else:
			r = mid - 1
	return r
(a, b, c) = map(int, input().split())
l = list('abcacba')
ans = 0
for _ in range(7):
	ans = max(ans, binary_search())
	l = l[1:] + [l[0]]
print(ans)


(a, b, c) = list(map(int, input().split()))
week = [1, 2, 3, 1, 3, 2, 1] + [1, 2, 3, 1, 3, 2, 1]

def findMaxDays(a, b, c, week):
	adiv = int(a / 3)
	bdiv = int(b / 2)
	cdiv = int(c / 2)
	divs = [adiv, bdiv, cdiv]
	mindiv = min(divs)
	amod = a - mindiv * 3
	bmod = b - mindiv * 2
	cmod = c - mindiv * 2
	mods = [amod, bmod, cmod]
	maxcount = 0
	for j in range(7):
		count = 0
		x = amod
		y = bmod
		z = cmod
		for i in week[j:]:
			if i == 1:
				if x > 0:
					x -= 1
				else:
					break
			elif i == 2:
				if y > 0:
					y -= 1
				else:
					break
			elif z > 0:
				z -= 1
			else:
				break
			count += 1
		maxcount = max(maxcount, count)
	total = mindiv * 7 + maxcount
	return total
print(findMaxDays(a, b, c, week))


(na, nb, nc) = map(int, input().split())
ans = 1
m = 0
(ta, tb, tc) = (3, 2, 2)
fw = min(na // ta, nb // tb, nc // tc)
na -= ta * fw
nb -= tb * fw
nc -= tc * fw
sans = fw * 7
for st in range(1, 8):
	(a, b, c) = (na, nb, nc)
	tans = sans
	wd = st
	while True:
		if wd == 1 or wd == 4 or wd == 7:
			if a == 0:
				break
			a -= 1
		elif wd == 2 or wd == 6:
			if b == 0:
				break
			b -= 1
		else:
			if c == 0:
				break
			c -= 1
		tans += 1
		wd = 1 if wd == 7 else wd + 1
	ans = max(ans, tans)
print(ans)


f = lambda : list(map(int, input().split()))

def solve():
	(a, b, c) = f()
	week = min(a // 3, b // 2, c // 2)
	a = a - 3 * week
	b = b - 2 * week
	c = c - 2 * week
	cost = [0, 1, 2, 0, 2, 1, 0]
	maxd = 0
	for i in range(7):
		d = 0
		remain = [a, b, c]
		while remain[cost[(i + d) % 7]] > 0:
			remain[cost[(i + d) % 7]] -= 1
			d += 1
		maxd = max(d, maxd)
	print(7 * week + maxd)
solve()


(a, b, c) = map(int, input().split())
m = min(a // 3, b // 2, c // 2)
ans = m * 7
a -= m * 3
b -= m * 2
c -= m * 2
add = 0
l0 = a
l1 = b
l2 = c
s = [1, 2, 3, 1, 3, 2, 1]
for i in range(7):
	t = i
	an = 0
	a = l0
	b = l1
	c = l2
	while a >= 0 and b >= 0 and (c >= 0):
		if s[t] == 1:
			a -= 1
			if a == -1:
				break
			an += 1
		elif s[t] == 2:
			b -= 1
			if b == -1:
				break
			an += 1
		else:
			c -= 1
			if c == -1:
				break
			an += 1
		t += 1
		t %= 7
	add = max(add, an)
print(ans + add)


from itertools import cycle
(f, r, c) = list(map(int, input().split()))
count = {'f': f, 'r': r, 'c': c}
food = {0: 'f', 1: 'f', 2: 'r', 3: 'c', 4: 'f', 5: 'c', 6: 'r'}

def check(day):
	day_ans = 0
	count_cpy = count.copy()
	for i in range(day, 7):
		if count_cpy[food[i]] == 0:
			return day_ans
		else:
			count_cpy[food[i]] -= 1
			day_ans += 1
	full = min(count_cpy['f'] // 3, count_cpy['r'] // 2, count_cpy['c'] // 2)
	count_cpy['f'] -= 3 * full
	count_cpy['r'] -= 2 * full
	count_cpy['c'] -= 2 * full
	day_ans += 7 * full
	i = 0
	while True:
		if count_cpy[food[i]] == 0:
			return day_ans
		else:
			count_cpy[food[i]] -= 1
			day_ans += 1
		i += 1
	return day_ans
ans = 0
for day in range(7):
	ans = max(ans, check(day))
print(ans)


(a, b, c) = map(int, input().split())
(d, e, f) = [3, 2, 2]
days = [[3, 2, 2], [2, 2, 2], [2, 1, 2], [2, 1, 1], [1, 1, 1], [1, 1, 0], [1, 0, 0]]
foods = [0, 1, 2, 0, 2, 1, 0]
minA = -1
ans = [0]
for i in range(7):
	(fi, s, t) = (a - days[i][0], b - days[i][1], c - days[i][2])
	count = 0
	if fi >= 0 and s >= 0 and (t >= 0):
		count = 7 - i
		first = fi // d
		second = s // e
		third = t // f
		minA = min(first, second, third)
		first = minA * d
		second = minA * e
		third = minA * f
		aa = a - first - days[i][0]
		bb = b - second - days[i][1]
		cc = c - third - days[i][2]
		arr = [aa, bb, cc]
		count += 7 * minA
		for k in foods:
			if arr[k] > 0:
				count += 1
				arr[k] -= 1
			else:
				break
		ans.append(count)
	else:
		arr = [a, b, c]
		for ii in range(7):
			idex = ii
			for jj in range(7):
				if idex > 6:
					idex = 0
				if arr[foods[idex]] > 0:
					arr[foods[idex]] -= 1
					count += 1
				else:
					ans.append(count)
					count = 0
					arr = [a, b, c]
					break
				idex += 1
print(max(ans))


l = [int(x) for x in input().split()]
c = min(l[0] // 3, l[1] // 2, l[2] // 2)
l[0] -= 3 * c
l[1] -= 2 * c
l[2] -= 2 * c
d = [0, 0, 1, 2, 0, 2, 1]
b = 0
for i in range(7):
	e = 0
	j = i
	f = l.copy()
	while f[d[j]] != 0:
		f[d[j]] -= 1
		e += 1
		j = (j + 1) % 7
	if e > b:
		b = e
print(b + c * 7)


(a, b, c) = map(int, input().split())
w = min(a // 3, b // 2, c // 2)
r = [a - 3 * w, b - 2 * w, c - 2 * w]
m = [0, 1, 2, 0, 2, 1, 0]
h = 0
for i in range(7):
	c = r[:]
	d = 0
	while c[m[(i + d) % 7]] > 0:
		c[m[(i + d) % 7]] -= 1
		d += 1
	h = max(h, d)
print(7 * w + h)


(f, r, c) = list(map(int, input().split()))
ans = min(f // 3, min(r // 2, c // 2))
if ans > 0:
	f = f - ans * 3
	r = r - ans * 2
	c = c - ans * 2
ans = ans * 7
maxa = 0
fish = f
rabbit = r
chicken = c
for i in range(7):
	count = 0
	flag = 0
	for j in range(7):
		a = (i + j) % 7
		if a == 0 or a == 1 or a == 4:
			if f == 0:
				flag = 1
			f -= 1
		if a == 2 or a == 6:
			if r == 0:
				flag = 1
			r -= 1
		if a == 3 or a == 5:
			if c == 0:
				flag = 1
			c -= 1
		if flag == 0:
			count += 1
		else:
			break
	maxa = max(count, maxa)
	f = fish
	r = rabbit
	c = chicken
print(ans + maxa)


import math
list1 = list(map(int, input().split()))
list2 = [list1[0] / 3, list1[1] / 2, list1[2] / 2]
list3 = []
n = list2.index(min(list2))
m = math.floor(list2[n])
list3.append(list1[0] - 3 * m)
list3.append(list1[1] - 2 * m)
list3.append(list1[2] - 2 * m)
food = [0, 1, 2, 0, 2, 1, 0]
day = [0, 0, 0, 0, 0, 0, 0]
for i in range(7):
	list4 = list(list3)
	for j in range(7):
		if list4[food[(j + i) % 7]] != 0:
			list4[food[(j + i) % 7]] -= 1
			day[i] += 1
		else:
			break
print(m * 7 + max(day))


(a, b, c) = list(map(int, input().split()))
meal = [0, 1, 2, 0, 2, 1, 0]
ans = 0
numWeeks = min(a // 3, b // 2, c // 2)
for start in range(7):
	newWeek = meal[start:] + meal[:start]
	left = [a - numWeeks * 3, b - numWeeks * 2, c - numWeeks * 2]
	tmp = numWeeks * 7
	for m in newWeek:
		if left[m] == 0:
			break
		left[m] -= 1
		tmp += 1
	ans = max(ans, tmp)
print(ans)


nums = [int(i) for i in input().split(' ')]
w = min([nums[0] // 3, nums[1] // 2, nums[2] // 2])
left = [nums[0] - 3 * w, nums[1] - 2 * w, nums[2] - 2 * w]
s = [0, 1, 2, 0, 2, 1, 0]
d = 0
for i in range(7):
	t = 0
	start = i
	temp = left.copy()
	while True:
		if temp[s[start]] < 1:
			break
		temp[s[start]] -= 1
		start = (start + 1) % 7
		t += 1
	if t > d:
		d = t
print(d + w * 7)


print_x = 0
g = input().split()
g_1 = int(g[0])
g_2 = int(g[1])
g_3 = int(g[2])
op = {1: g_1, 2: g_2, 3: g_3}
g = {1: (1, 0, 0), 2: (1, 0, 0), 3: (0, 1, 0), 4: (0, 0, 1), 5: (1, 0, 0), 6: (0, 0, 1), 7: (0, 1, 0)}

def havij():
	global g_1_cop, g_2_cop, g_3_cop, i, g
	for v in g:
		if v == i:
			g_1_cop -= g[v][0]
			g_2_cop -= g[v][1]
			g_3_cop -= g[v][2]
			return
g_1_c = g_1 * 2 // 3
g_2_c = g_2
g_3_c = g_3
if min(g_1_c, g_2_c, g_3_c) == g_1_c:
	mini_cop = g_1
else:
	mini_cop = min(g_1, g_2, g_3)
g_1_c = g_1
if mini_cop == g_1:
	mini = mini_cop // 3
else:
	mini = mini_cop // 2
t_cop = 0
if mini_cop > 100000:
	g_1_c -= 3 * mini
	g_2_c -= 2 * mini
	g_3_c -= 2 * mini
	t_cop = 7 * mini
	g_1 = g_1_c
	g_2 = g_2_c
	g_3 = g_3_c
for i in range(1, 8):
	tam = False
	t = t_cop
	g_1_cop = g_1
	g_2_cop = g_2
	g_3_cop = g_3
	while g_1_cop > 2 and g_2_cop > 1 and (g_3_cop > 1):
		g_1_cop -= 3
		g_2_cop -= 2
		g_3_cop -= 2
		t += 7
	while g_1_cop > -1 and g_2_cop > -1 and (g_3_cop > -1):
		havij()
		t += 1
		i += 1
		if i > 7:
			i -= 7
	if print_x < t:
		print_x = t
print(print_x - 1)


def main():
	(a, b, c) = map(int, input().split())

	class Food:

		def __init__(self, amount):
			self.amount = amount

		def __str__(self):
			return str(self.amount)

	def calc(a, b, c, start, foodA, foodB, foodC, food):
		if start == 6:
			start = 6
		days = 0
		if start > 1:
			for day in range(start, 8):
				if food[day].amount > 0:
					days += 1
					food[day].amount -= 1
				else:
					break
		weeks = min(foodA.amount // 3, foodB.amount // 2, foodC.amount // 2)
		days += 7 * weeks
		foodA.amount -= 3 * weeks
		foodB.amount -= 2 * weeks
		foodC.amount -= 2 * weeks
		ok = True
		while ok:
			day_of_week = (start + days - 1) % 7 + 1
			if food[day_of_week].amount > 0:
				days += 1
				food[day_of_week].amount -= 1
			else:
				ok = False
		return days
	max_days = 0
	for start in range(1, 8):
		foodA = Food(a)
		foodB = Food(b)
		foodC = Food(c)
		food = [None, foodA, foodB, foodC, foodA, foodC, foodB, foodA]
		max_days = max(max_days, calc(a, b, c, start, foodA, foodB, foodC, food))
	print(max_days)
main()


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


import sys
sys_input = sys.stdin.readline

def si():
	return sys_input().rstrip()

def ii():
	return int(si())

def sti():
	return si().split()

def iti():
	return map(int, sti())

def sli():
	return list(si())

def ili():
	return list(iti())

def main():
	a = L[0] // 3
	b = L[1] // 2
	c = L[2] // 2
	l = [a, b, c]
	w = min(l)
	aa = L[0] - w * 3
	bb = L[1] - w * 2
	cc = L[2] - w * 2
	ll = [aa, bb, cc]
	ws = [0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0]
	maa = 0
	for i in range(7):
		ll = [aa, bb, cc]
		for (j, d) in enumerate(ws[i:i + 7]):
			if ll[d] == 0:
				if maa < j:
					maa = j
				break
			ll[d] -= 1
	print(w * 7 + maa)
	return
L = ili()
main()


import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10, log2, floor
from itertools import permutations
from heapq import heappush, heappop, heapify
inf = float('inf')
mod = 1000000007

def factorial_p(n, p):
	ans = 1
	if n <= p // 2:
		for i in range(1, n + 1):
			ans = ans * i % p
	else:
		for i in range(1, p - n):
			ans = ans * i % p
		ans = pow(ans, p - 2, p)
		if n % 2 == 0:
			ans = p - ans
	return ans

def nCr_p(n, r, p):
	ans = 1
	while n != 0 or r != 0:
		(a, b) = (n % p, r % p)
		if a < b:
			return 0
		ans = ans * factorial_p(a, p) * pow(factorial_p(b, p), p - 2, p) * pow(factorial_p(a - b, p), p - 2, p) % p
		n //= p
		r //= p
	return ans

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def expo(x, n):
	if n == 0:
		return 1
	result = 1
	while n > 1:
		if n & 1:
			result = result * x
			n -= 1
		else:
			n //= 2
			x = x * x
	return result * x

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(a, b, c) = get_ints()
ans = min(a // 3, b // 2, c // 2)
a -= 3 * ans
b -= 2 * ans
c -= 2 * ans
arr = [0, 1, 2, 0, 2, 1, 0]
arr += arr
res = 0
for i in range(7):
	(_a, _b, _c) = (a, b, c)
	count = 0
	week = arr[i:i + 7]
	for j in range(7):
		if -1 in [_a, _b, _c]:
			break
		if week[j] == 0:
			_a -= 1
		if week[j] == 1:
			_b -= 1
		if week[j] == 2:
			_c -= 1
		count += 1
	res = max(res, ans * 7 + count - 1)
print(res)


eat = [0, 1, 2, 0, 2, 1, 0]

def test(a, k):
	count = 0
	weeks = min(a[0] // 3, a[1] // 2, a[2] // 2)
	a[0] -= 3 * weeks
	a[1] -= 2 * weeks
	a[2] -= 2 * weeks
	count += 7 * weeks
	while True:
		i = eat[k % 7]
		if a[i] == 0:
			break
		a[i] -= 1
		count += 1
		k += 1
	return count
a = list(map(int, input().split()))
print(max([test(a.copy(), k) for k in range(7)]))


(a, b, c) = list(map(int, input().split()))
max_days = 0
min_val = min(a // 3, b // 2, c // 2)
fixed_days = 7 * min_val
(a, b, c) = (a - min_val * 3, b - min_val * 2, c - min_val * 2)
for i in range(7):
	(a1, b1, c1) = (a, b, c)
	week_map = {0: a1, 1: a1, 2: b1, 3: c1, 4: a1, 5: c1, 6: b1}
	days = 0
	for j in range(i, i + 7):
		if week_map[j % 7] == 0:
			break
		if j % 7 in [0, 1, 4]:
			week_map[0] -= 1
			week_map[1] -= 1
			week_map[4] -= 1
		elif j % 7 in [2, 6]:
			week_map[2] -= 1
			week_map[6] -= 1
		else:
			week_map[3] -= 1
			week_map[5] -= 1
		days += 1
	if days >= max_days:
		max_days = days
print(max_days + fixed_days)


inp = input().split(' ')
[a, b, c] = [int(inp[0]), int(inp[1]), int(inp[2])]
cnt = 0
a1 = int(a / 3)
b1 = int(b / 2)
c1 = int(c / 2)
z = [a1, b1, c1]
cnt = min(z)
a = a - cnt * 3
b = b - cnt * 2
c = c - cnt * 2
arr = ['a', 'b', 'c', 'a', 'c', 'b', 'a']
brr = [0] * 7
for i in range(7):
	j = i
	x = a
	y = b
	z = c
	while a > 0 or b > 0 or c > 0:
		j = j % 7
		if arr[j] == 'a':
			if x > 0:
				brr[i] += 1
				x -= 1
			else:
				break
		if arr[j] == 'b':
			if y > 0:
				brr[i] += 1
				y -= 1
			else:
				break
		if arr[j] == 'c':
			if z > 0:
				brr[i] += 1
				z -= 1
			else:
				break
		j += 1
m = max(brr)
days = cnt * 7 + m
print(days)


(a, b, c) = map(int, input().split())
d = min(a // 3, b // 2, c // 2)
(a, b, c) = (a - 3 * d, b - 2 * d, c - 2 * d)
if min(a, 3) == 1 and min(b, 2) == 2 and (min(c, 2) == 1):
	k = 3
elif b == 0:
	k = max(min(a, 1) + min(c, 2), min(a, 2))
elif a == 0:
	k = min(b, 1) + min(c, 1)
elif c == 0:
	if min(a, 3) >= 2:
		k = min(a, 2) + min(b, 2)
	else:
		k = min(a, 1) + min(b, 1)
else:
	k = min(a, 3) + min(b, 2) + min(c, 2)
print(7 * d + k)


def main():
	(a, b, c) = map(int, input().split())
	weeks = min(a // 3, b // 2, c // 2)
	max_days = 7 * weeks
	a -= 3 * weeks
	b -= 2 * weeks
	c -= 2 * weeks
	max_val = 0
	(ta, tb, tc) = (a, b, c)
	for i in range(7):
		days = i
		(a, b, c) = (ta, tb, tc)
		while True:
			if days % 7 == 0 or days % 7 == 3 or days % 7 == 6:
				if a > 0:
					a -= 1
					days += 1
				else:
					break
			elif days % 7 == 1 or days % 7 == 5:
				if b > 0:
					b -= 1
					days += 1
				else:
					break
			elif c > 0:
				c -= 1
				days += 1
			else:
				break
		max_val = max(max_val, days - i)
	print(max_days + max_val)
main()


from sys import setcheckinterval, stdin, setrecursionlimit
setcheckinterval(1000)
setrecursionlimit(10 ** 6)
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
days = [0, 1, 2, 0, 2, 1, 0]
a = lin()
dd = min(a[0] // 3, a[1] // 2, a[2] // 2)
ans = dd * 7
a[0] -= dd * 3
a[1] -= dd * 2
a[2] -= dd * 2
ch = 0
for i in range(7):
	ch1 = 0
	cp = a[:]
	for j in range(i, i + 7):
		if cp[days[j % 7]]:
			ch1 += 1
			cp[days[j % 7]] -= 1
		else:
			break
	ch = max(ch, ch1)
print(ans + ch)


(a1, b1, c1) = list(map(int, input().split()))
day = []
day_flag = []
a = []
b = []
c = []
N = min(a1 // 3, b1 // 2, c1 // 2)
a1 -= 3 * N
b1 -= 2 * N
c1 -= 2 * N
for i in range(7):
	day.append(0)
	day_flag.append(True)
	a.append(a1)
	b.append(b1)
	c.append(c1)
j = 1
while max(day_flag):
	for k in range(7):
		if day_flag[k]:
			if (j + k) % 7 == 0 or (j + k) % 7 == 1 or (j + k) % 7 == 4:
				if a[k] != 0:
					a[k] -= 1
					day[k] += 1
				else:
					day_flag[k] = False
			elif (j + k) % 7 == 2 or (j + k) % 7 == 6:
				if b[k] != 0:
					b[k] -= 1
					day[k] += 1
				else:
					day_flag[k] = False
			elif c[k] != 0:
				c[k] -= 1
				day[k] += 1
			else:
				day_flag[k] = False
	j += 1
print(max(day) + 7 * N)


l = list(map(int, input().split()))
nl = [l[0] // 3, l[1] // 2, l[2] // 2]
m = min(nl)
ans = 7 * m
l[0] -= m * 3
l[1] -= m * 2
l[2] -= m * 2
best = 0
week = [0, 0, 1, 2, 0, 2, 1]
for day in range(7):
	curr = 0
	cl = list(l)
	while True:
		if cl[week[day]] > 0:
			cl[week[day]] -= 1
			day += 1
			day %= 7
			curr += 1
		else:
			break
	best = max(best, curr)
print(ans + best)


(a, b, c) = map(int, input().split())
ans = 0
weeks = min(a // 3, b // 2, c // 2)
weeks = 2 if weeks - 2 < 0 else weeks
ans += (weeks - 2) * 7
a -= (weeks - 2) * 3
b -= (weeks - 2) * 2
c -= (weeks - 2) * 2
kek = 0
for i in range(7):
	j = i
	temp_ans = 0
	a_temp = a
	b_temp = b
	c_temp = c
	while True:
		if j % 7 == 0 or j % 7 == 3 or j % 7 == 6:
			if a_temp == 0:
				break
			a_temp -= 1
			temp_ans += 1
		elif j % 7 == 1 or j % 7 == 5:
			if b_temp == 0:
				break
			b_temp -= 1
			temp_ans += 1
		elif j % 7 == 2 or j % 7 == 4:
			if c_temp == 0:
				break
			c_temp -= 1
			temp_ans += 1
		j += 1
	kek = max(kek, temp_ans)
print(ans + kek)


(f, r, c) = [int(z) for z in input().split()]
weeks = min(f / 3, r / 2, c / 2)
weeks = int(weeks)
f = t1 = f - 3 * weeks
r = t2 = r - 2 * weeks
c = t3 = c - 2 * weeks
total = f + r + c
ans_day = 0
day = 0
flag = 1
for starting in range(0, 7):
	i = starting
	count = 0
	flag = 1
	f = t1
	r = t2
	c = t3
	while True:
		if i % 7 == 0 or i % 7 == 3 or i % 7 == 6:
			if f == 0:
				flag = 0
			f -= 1
		elif i % 7 == 1 or i % 7 == 5:
			if r == 0:
				flag = 0
			r -= 1
		elif i % 7 == 2 or i % 7 == 4:
			if c == 0:
				flag = 0
			c -= 1
		i += 1
		if flag == 0:
			break
		count += 1
	ans_day = max(ans_day, count)
ans = 7 * weeks + ans_day
print(ans)


(a, b, c) = map(int, input().split())
d = {0: 0, 1: 0, 2: 1, 3: 2, 4: 0, 5: 2, 6: 1}
weeks = min(a // 3, b // 2, c // 2)
a -= weeks * 3
b -= weeks * 2
c -= weeks * 2
days = 0
for start in range(7):
	L = [a, b, c]
	for i in range(7):
		j = (start + i) % 7
		k = d[j]
		if L[k]:
			L[k] -= 1
		else:
			days = max(days, i)
			break
	else:
		days = 7
print(weeks * 7 + days)


import fractions
(a1, b1, c1) = list(map(int, input().split()))
weeks = min(a1 // 3, b1 // 2, c1 // 2)
a1 -= 3 * weeks
b1 -= 2 * weeks
c1 -= 2 * weeks
dic = {0: 'a', 1: 'b', 2: 'c', 3: 'a', 4: 'c', 5: 'b', 6: 'a'}
d = []
for i in range(0, 7):
	counter = 0
	a = a1
	b = b1
	c = c1
	for day in range(0, 7):
		t = dic[(i + day) % 7]
		z = a
		if t == 'b':
			z = b
		elif t == 'c':
			z = c
		if z != 0:
			counter += 1
			if t == 'b':
				b -= 1
			elif t == 'c':
				c -= 1
			elif t == 'a':
				a -= 1
		else:
			d.append(counter)
			break
print(max(d) + 7 * weeks)


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict

def main():

	def days(a1, b1, c1, rtmp):
		week = min(a1 // 3, b1 // 2, c1 // 2)
		a1 -= week * 3
		b1 -= week * 2
		c1 -= week * 2
		daylong = 0
		foods = ['a', 'b', 'c', 'a', 'c', 'b', 'a']
		while True:
			if foods[daylong] == 'a':
				if a1 == 0:
					break
				else:
					a1 -= 1
			elif foods[daylong] == 'b':
				if b1 == 0:
					break
				else:
					b1 -= 1
			elif c1 == 0:
				break
			else:
				c1 -= 1
			daylong += 1
		rtmp += week * 7 + daylong
		return rtmp
	(a, b, c) = map(int, input().split())
	r1 = days(a, b, c, 0)
	r2 = days(a + 1, b, c, -1)
	r3 = days(a + 1, b + 1, c, -2)
	r4 = days(a + 1, b + 1, c + 1, -3)
	r5 = days(a + 2, b + 1, c + 1, -4)
	r6 = days(a + 2, b + 1, c + 2, -5)
	r7 = days(a + 2, b + 2, c + 2, -6)
	r = max(r1, r2, r3, r4, r5, r6, r7)
	print(r)
main()


(a, b, c) = [int(x) for x in input().split()]
start = {}
start1 = {}
start[1] = [3, 2, 2]
start[2] = [2, 2, 2]
start[3] = [2, 1, 2]
start[4] = [2, 1, 1]
start[5] = [1, 1, 1]
start[6] = [1, 1, 0]
start[7] = [1, 0, 0]
start1[3, 2, 2] = 1
start1[2, 2, 2] = 2
start1[2, 1, 2] = 3
start1[2, 1, 1] = 4
start1[1, 1, 1] = 5
start1[1, 1, 0] = 6
start1[1, 0, 0] = 7
start1[0, 0, 0] = 8
answer = []
if a > 1 and b == 1 and (c == 1):
	print(4)
elif a == 1 and b == 1 or (a == 1 and c == 1):
	if a == 1 and b == 1 and (c == 2):
		print(4)
	else:
		print(3)
elif a == 1:
	print(5)
elif c == 1:
	if a > 2:
		print(6)
	else:
		print(5)
elif b == 1:
	if a > 2:
		print(6)
	else:
		print(5)
else:
	for i in range(1, 8):
		a1 = b1 = c1 = 0
		if a >= start[i][0]:
			a1 = (a - start[i][0]) // 3 * 7 + 8 - i
		if (a - start[i][0]) % 3 == 1 or a == 1:
			a1 += 3
		elif (a - start[i][0]) % 3 == 2:
			a1 += 6
		if b >= start[i][1]:
			b1 = (b - start[i][1]) // 2 * 7 + 8 - i
		if (b - start[i][1]) % 2 == 0:
			b1 += 1
		elif (b - start[i][1]) % 2 == 1 or b == 1:
			b1 += 5
		if c >= start[i][2]:
			c1 = (c - start[i][2]) // 2 * 7 + 8 - i
		if (c - start[i][2]) % 2 == 0:
			c1 += 2
		elif (c - start[i][2]) % 2 == 1 or c == 1:
			c1 += 4
		answer.append(min(a1, b1, c1))
	print(max(answer))


a = [int(x) for x in input().split()]
full = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= 3 * full
a[1] -= 2 * full
a[2] -= 2 * full
idx = [0, 1, 2, 0, 2, 1, 0]
ans = 0
for start in range(7):
	(d, cur, a_copy) = (start, 0, a.copy())
	while a_copy[idx[d]] > 0:
		a_copy[idx[d]] -= 1
		cur += 1
		d = (d + 1) % 7
	ans = max(ans, cur)
print(7 * full + ans)


(a, b, c) = map(int, input().split())
x = min([a // 3, b // 2, c // 2])
a -= x * 3
b -= x * 2
c -= x * 2
s = (a, b, c)
x *= 7
ans = x
for o in range(7):
	y = x
	(a, b, c) = s
	for j in range(7):
		i = (j + o) % 7
		if i == 0 or i == 3 or i == 6:
			if a == 0:
				break
			a -= 1
		if i == 1 or i == 5:
			if b == 0:
				break
			b -= 1
		if i == 2 or i == 4:
			if c == 0:
				break
			c -= 1
		y += 1
	ans = max(ans, y)
print(ans)


(a, b, c) = map(int, input().split())
D = min(a // 3, b // 2, c // 2)
(A, B, C) = (a - 3 * D, b - 2 * D, c - 2 * D)
ans = D * 7
if A == 0 and C == 0 and (B == 0):
	print(ans)
elif C == 0 and B == 0:
	if A == 1:
		print(ans + 1)
	else:
		print(ans + 2)
elif C == 0:
	if B == 1 and A == 1:
		print(ans + 2)
	elif B == 1 and A >= 2:
		print(ans + 3)
	elif B == 1 and A == 0:
		print(ans + 1)
	elif A == 0:
		print(ans + 1)
	elif A == 1:
		print(ans + 2)
	else:
		print(ans + 4)
elif C == 1:
	if B == 1:
		if A == 1:
			print(ans + 3)
		elif A == 0:
			print(ans + 2)
		else:
			print(ans + 4)
	elif B == 0:
		if A == 0:
			print(ans)
		elif A == 1:
			print(ans + 2)
		else:
			print(ans + 2)
	elif A == 0:
		print(ans + 2)
	elif A == 1:
		print(ans + 3)
	elif A == 2:
		print(ans + 5)
	else:
		print(ans + 6)
else:
	if B == 0:
		if A == 0:
			print(ans + 1)
		elif A == 1:
			print(ans + 2)
		else:
			print(ans + 3)
	if B == 1:
		if A == 0:
			print(ans + 2)
		elif A == 1:
			print(ans + 4)
		elif A == 2:
			print(ans + 5)
		else:
			print(ans + 6)
	elif A == 0:
		print(ans + 2)
	elif A == 1:
		print(ans + 5)
	elif A == 2:
		print(ans + 6)


import sys, math, queue
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7

def addRem(st, x, y, z):
	if st in {0, 3, 6}:
		if x > 0:
			return 1 + addRem((st + 1) % 7, x - 1, y, z)
		return 0
	elif st in {1, 5}:
		if y > 0:
			return 1 + addRem((st + 1) % 7, x, y - 1, z)
		return 0
	else:
		if z > 0:
			return 1 + addRem((st + 1) % 7, x, y, z - 1)
		return 0
(a, b, c) = map(int, input().split())
ans = 0
for i in range(7):
	d = 7 * min(a // 3, b // 2, c // 2)
	d += addRem(i, a - d // 7 * 3, b - d // 7 * 2, c - d // 7 * 2)
	ans = max(ans, d)
print(ans)


from fractions import gcd
from collections import Counter

def main():
	B = [int(s) for s in input().split(' ')]
	A = [0, 1, 2, 0, 2, 1, 0]
	len = 0
	for i in range(7):
		B1 = B.copy()
		len1 = 0
		for j in range(i, 7):
			if B1[A[j]] > 0:
				len1 += 1
				B1[A[j]] -= 1
			else:
				break
		k = min(B1[0] // 3, B1[1] // 2, B1[2] // 2)
		len1 += k * 7
		B1[0] -= 3 * k
		B1[1] -= 2 * k
		B1[2] -= 2 * k
		for j in range(7):
			if B1[A[j]] > 0:
				len1 += 1
				B1[A[j]] -= 1
			else:
				break
		if len1 > len:
			len = len1
	print(len)
main()


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)


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)


(a, b, c) = input().split()
(a, b, c) = (int(a), int(b), int(c))
t = min(int(a / 3), int(b / 2), int(c / 2))
a = a - t * 3
b = b - t * 2
c = c - t * 2
if a > 3:
	a = 3
if b > 2:
	b = 2
if c > 2:
	c = 2
s = 0
if a == 3:
	if b == 0 and c == 0:
		s = 2
	elif b == 0:
		s = a + c - 2
	elif c == 0:
		s = a + b - 1
	else:
		s = a + b + c
elif a == 2:
	if b == 0 and c <= 2:
		s = a + c - 1
	else:
		s = a + b + c
elif a == 1:
	if b == 2 and c <= 1:
		s = 2 + c
	else:
		s = a + b + c
else:
	s = min(b, 1) + min(c, 1)
print(t * 7 + s)


abc = input().split()
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
l = min(int(a / 3), int(b / 2), int(c / 2))
at = a - 3 * l
bt = b - 2 * l
ct = c - 2 * l
maxx = 0
for i in range(7):
	at = a - 3 * l
	bt = b - 2 * l
	ct = c - 2 * l
	temp = 0
	check = True
	for j in range(i, 7):
		if j == 0 and at == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 0 and at > 0:
			at -= 1
			temp += 1
		if j == 1 and bt == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 1 and bt > 0:
			bt -= 1
			temp += 1
		if j == 2 and ct == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 2 and ct > 0:
			ct -= 1
			temp += 1
		if j == 3 and at == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 3 and at > 0:
			at -= 1
			temp += 1
		if j == 4 and ct == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 4 and ct > 0:
			ct -= 1
			temp += 1
		if j == 5 and bt == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 5 and bt > 0:
			bt -= 1
			temp += 1
		if j == 6 and at == 0:
			maxx = max(maxx, temp)
			check = False
			break
		if j == 6 and at > 0:
			at -= 1
			temp += 1
	if check:
		for j in range(0, i):
			if j == 0 and at == 0:
				maxx = max(maxx, temp)
				break
			if j == 0 and at > 0:
				at -= 1
				temp += 1
			if j == 1 and bt == 0:
				maxx = max(maxx, temp)
				break
			if j == 1 and bt > 0:
				bt -= 1
				temp += 1
			if j == 2 and ct == 0:
				maxx = max(maxx, temp)
				break
			if j == 2 and ct > 0:
				ct -= 1
				temp += 1
			if j == 3 and at == 0:
				maxx = max(maxx, temp)
				break
			if j == 3 and at > 0:
				at -= 1
				temp += 1
			if j == 4 and ct == 0:
				maxx = max(maxx, temp)
				break
			if j == 4 and ct > 0:
				ct -= 1
				temp += 1
			if j == 5 and bt == 0:
				maxx = max(maxx, temp)
				break
			if j == 5 and bt > 0:
				bt -= 1
				temp += 1
			if j == 6 and at == 0:
				maxx = max(maxx, temp)
				break
			if j == 6 and at > 0:
				at -= 1
				temp += 1
days = 7 * l + maxx
print(days)


def ok(korm):
	return korm[0] >= 0 and korm[1] >= 0 and (korm[2] >= 0)
korm = list(map(int, input().split()))
n = min(korm[0] // 3, korm[1] // 2, korm[2] // 2)
korm[0] -= 3 * n
korm[1] -= 2 * n
korm[2] -= 2 * n
week = [0, 1, 2, 0, 2, 1, 0]
max_ = 0
for i in range(7):
	day = i
	ost = korm.copy()
	count = 0
	while True:
		ost[week[day]] -= 1
		day = (day + 1) % 7
		if ok(ost):
			count += 1
		else:
			break
	if count > max_:
		max_ = count
print(n * 7 + max_)


(f, r, c) = map(int, input().split())
a = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
ans = 0
for i in range(7):
	F = f
	R = r
	C = c
	cur = 0
	for j in range(i, 7):
		if a[j] == 'f':
			if F == 0:
				break
			F = max(F - 1, 0)
		elif a[j] == 'r':
			if R == 0:
				break
			R = max(R - 1, 0)
		else:
			if C == 0:
				break
			C = max(C - 1, 0)
	cur += f - F + (r - R) + (c - C)
	add = min(F // 3, R // 2, C // 2) * 7
	if add > 0:
		F -= add * 3 // 7
		R -= add * 2 // 7
		C -= add * 2 // 7
		cur += add
	j = 0
	while True:
		if a[j % 7] == 'f':
			if F == 0:
				break
			F = max(F - 1, 0)
		elif a[j % 7] == 'r':
			if R == 0:
				break
			R = max(R - 1, 0)
		else:
			if C == 0:
				break
			C = max(C - 1, 0)
		j += 1
		cur += 1
	ans = max(ans, cur)
print(ans)


l = list(map(int, input().split()))
final = min([int(l[0] / 3), int(l[1] / 2), int(l[2] / 2)])
count = 7 * final
val_temp = [3, 2, 2]
s = [l[0] - 3 * final, l[1] - 2 * final, l[2] - 2 * final]
val = [0, 1, 2, 0, 2, 1, 0]
days = 0
for i in range(7):
	temp = [x for x in s]
	j = i
	sday = 0
	while temp[val[j]] != 0:
		temp[val[j]] -= 1
		j = (1 + j) % 7
		sday += 1
	days = max(days, sday)
print(count + days)


import sys
input = sys.stdin.readline
cat = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
food = list(map(int, input().split()))
L = []
L.append(food[0] // 3)
L.append(food[1] // 2)
L.append(food[2] // 2)
food[0] -= min(L) * 3
food[1] -= min(L) * 2
food[2] -= min(L) * 2
m = 0
for i in range(7):
	check = 0
	temp = [i for i in food]
	for j in range(7):
		y = (i + j) % 7
		if cat[y] == 'f':
			if temp[0] == 0:
				break
			temp[0] -= 1
			check += 1
		if cat[y] == 'r':
			if temp[1] == 0:
				break
			temp[1] -= 1
			check += 1
		if cat[y] == 'c':
			if temp[2] == 0:
				break
			temp[2] -= 1
			check += 1
	m = max(m, check)
print(min(L) * 7 + m)


def input_ints():
	return [int(x) for x in input().split()]

def solve(a, b, c):
	n_weeks = min(a // 3, b // 2, c // 2)
	a -= n_weeks * 3
	b -= n_weeks * 2
	c -= n_weeks * 2
	cfg = [0, 1, 2, 0, 2, 1, 0]
	best = 0
	for i in range(len(cfg)):
		abc = [a, b, c]
		week = cfg[i:] + cfg[:i]
		score = 0
		for x in week:
			if abc[x] == 0:
				break
			score += 1
			abc[x] -= 1
		best = max(best, score)
	return best + n_weeks * 7
(a, b, c) = input_ints()
print(solve(a, b, c))


(a, b, c) = map(int, input().split())
d = min(a // 3, b // 2, c // 2)
arr = [i for i in range(7)] * 2
ans = 0
(a, b, c) = (a - d * 3, b - d * 2, c - d * 2)
for i in range(7):
	j = i
	count = 0
	m = a
	n = b
	k = c
	while j < 14 and m >= 0 and (n >= 0) and (k >= 0):
		if arr[j] == 0 or arr[j] == 3 or arr[j] == 6:
			m -= 1
			count += 1
		elif arr[j] == 1 or arr[j] == 5:
			n -= 1
			count += 1
		elif arr[j] == 2 or arr[j] == 4:
			k -= 1
			count += 1
		j += 1
	ans = max(ans, count - 1)
print(ans + d * 7)


gi = lambda : list(map(int, input().strip().split()))
(a, b, c) = gi()
(x, y, z) = (a // 3, b // 2, c // 2)
aa = min(x, y, z)
if aa:
	aa -= 1
	a -= aa * 3
	b -= aa * 2
	c -= aa * 2

def f(k, a, b, c):
	i = k
	d = 0
	while a >= 0 and b >= 0 and (c >= 0):
		if i == 0 or i == 3 or i == 6:
			a -= 1
		elif i == 1 or i == 5:
			b -= 1
		else:
			c -= 1
		d += 1
		i += 1
		i %= 7
	return d - 1
ans = 0
aa *= 7
for k in range(7):
	ans = max(ans, f(k, a, b, c))
print(ans + aa)


(a, b, c) = [int(x) for x in input().split()]
shed = [0, 1, 2, 0, 2, 1, 0]
days = 0
while a >= 3 and b >= 2 and (c >= 2):
	a -= 3
	b -= 2
	c -= 2
	days += 7

def check(st, cs):
	for i in range(7):
		tp = shed[(i + st) % 7]
		if cs[tp] == 0:
			return i
		cs[tp] -= 1
max_add_days = 0
for st in range(7):
	add_days = check(st, [a, b, c])
	if add_days > max_add_days:
		max_add_days = add_days
print(max_add_days + days)


(a, b, c) = map(int, input().split())
u = [a // 3, b // 2, c // 2]
w = min(u)
a -= w * 3
b -= w * 2
c -= w * 2
ans = 0
r = ['a', 'b', 'c', 'a', 'c', 'b', 'a', 'a', 'b', 'c', 'a', 'c', 'b', 'a']
for i in range(7):
	a1 = a
	b1 = b
	c1 = c
	k = 0
	for j in range(i, i + 7):
		if r[j] == 'a':
			a1 -= 1
		elif r[j] == 'b':
			b1 -= 1
		else:
			c1 -= 1
		if a1 < 0 or b1 < 0 or c1 < 0:
			break
		k += 1
	if k > ans:
		ans = k
print(ans + w * 7)


bas = ['FRCFCRF', 'RCFCRFF', 'CFCRFFR', 'FCRFFRC', 'CRFFRCF', 'RFFRCFC', 'FFRCFCR']
dd = []
for i in range(7):
	base = bas[i]
	for s in range(7):
		for e in range(s + 1, 7):
			kk = base[s:e]
			p = [kk.count('F'), kk.count('R'), kk.count('C')]
			dd.append((p, sum(p)))
(a, b, c) = map(int, input().split())
k1 = a // 3
k2 = b // 2
k3 = c // 2
t = min(k1, k2, k3)
a -= t * 3
b -= t * 2
c -= t * 2
best = 0
for i in dd:
	(s, uz) = i
	(fs, rs, cs) = s
	if fs <= a and rs <= b and (cs <= c):
		best = max(best, uz)
print(7 * t + best)


food = [int(item) for item in input().split(' ')]
full_week = min(int(food[0] / 3), int(food[1] / 2), int(food[2] / 2))
if full_week:
	food[0] -= full_week * 3
	food[1] -= full_week * 2
	food[2] -= full_week * 2
res = 0
for week_day in range(2, 9):
	count = 0
	food0 = food[0]
	food1 = food[1]
	food2 = food[2]
	for index in list(range(week_day, 9)) + list(range(2, week_day)):
		if index in [2, 5, 8] and food0:
			food0 -= 1
			count += 1
		elif index in [3, 7] and food1:
			food1 -= 1
			count += 1
		elif index in [4, 6] and food2:
			food2 -= 1
			count += 1
		else:
			break
	if res < count:
		res = count
print(res + full_week * 7)


(F, R, C) = [int(x) for x in input().split()]
best = 0
string = 'FRCFCRF' + 'FRCFCRF'
for i in range(0, 7):
	D = {'F': F, 'R': R, 'C': C}
	days = 0
	bad = False
	tstring = string[i:i + 7]
	for j in tstring:
		if D[j] > 0:
			D[j] -= 1
			days += 1
		else:
			bad = True
			best = max(best, days)
			break
	if not bad:
		t = min(D['F'] // 3, D['R'] // 2, D['C'] // 2)
		if t > 0:
			days += 7 * t
			D['F'] -= 3 * t
			D['R'] -= 2 * t
			D['C'] -= 2 * t
		for j in tstring:
			if D[j] > 0:
				D[j] -= 1
				days += 1
			else:
				break
		best = max(days, best)
print(best)


import sys
import os
from io import BytesIO, IOBase
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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

class DSU:

	def __init__(self, length):
		self.length = length
		self.parent = [-1] * self.length

	def getParent(self, node, start):
		if node >= self.length:
			return False
		if self.parent[node] < 0:
			if start != node:
				self.parent[start] = node
			return node
		return self.getParent(self.parent[node], start)

	def union(self, node1, node2):
		parent1 = self.getParent(node1, node1)
		parent2 = self.getParent(node2, node2)
		if parent1 == parent2:
			return False
		elif self.parent[parent1] <= self.parent[parent2]:
			self.parent[parent1] += self.parent[parent2]
			self.parent[parent2] = parent1
		else:
			self.parent[parent2] += self.parent[parent1]
			self.parent[parent1] = parent2
		return True

	def getCount(self, node):
		return -self.parent[self.getParent(node, node)]

def exact(num):
	if abs(num - round(num)) <= 10 ** (-9):
		return round(num)
	return num

def solve(a, b, c):
	lst = [1, 2, 3, 1, 3, 2, 1, 1, 2, 3, 1, 3, 2, 1]
	days = min(a // 3, b // 2, c // 2)
	(d, e, f) = (a // 3, b // 2, c // 2)
	minn = min(d, e, f)
	a -= minn * 3
	b -= minn * 2
	c -= minn * 2
	(a1, b1, c1) = (a, b, c)
	maxx = -1
	for i in range(7):
		start = i
		end = -1
		(a, b, c) = (a1, b1, c1)
		for j in range(i, i + 7):
			if lst[j] == 1:
				if a == 0:
					break
				else:
					a -= 1
			if lst[j] == 2:
				if b == 0:
					break
				else:
					b -= 1
			if lst[j] == 3:
				if c == 0:
					break
				else:
					c -= 1
			end = j
		if end == -1:
			maxx = max(maxx, 0)
		else:
			maxx = max(maxx, end - start + 1)
	return maxx + days * 7
(a, b, c) = list(map(int, input().split()))
print(solve(a, b, c))


(r, d, c) = list(map(int, input().split()))
stat = ['r', 'd', 'c', 'r', 'c', 'd', 'r']
day = 0
days = []
for j in range(len(stat)):
	data = [r, d, c]
	new_stat = stat[j:] + stat[:j]
	max_week = min(data[0] // 3, data[1] // 2, data[2] // 2)
	check = [data[0] - max_week * 3, data[1] - max_week * 2, data[2] - max_week * 2]
	day = 0
	j = 0
	while True:
		i = new_stat[j]
		if i == 'r':
			check[0] -= 1
		elif i == 'd':
			check[1] -= 1
		elif i == 'c':
			check[2] -= 1
		day += 1
		if -1 in check:
			break
		j = (j + 1) % 7
	days.append(max_week * 7 + day - 1)
print(max(days))


nums = input().split(' ')
nums = [int(i) for i in nums]
d = {'f': nums[0], 'k': nums[1], 'c': nums[2]}
if nums[1] > nums[2]:
	nums2min = nums[2]
else:
	nums2min = nums[1]
if nums[0] // 3 > nums2min // 2:
	week = nums2min // 2
else:
	week = nums[0] // 3
n = nums[:]
x = week
nums = [n[0] - 3 * week, n[1] - 2 * week, n[2] - 2 * week]
week = [0, 'f', 'k', 'c', 'f', 'c', 'k', 'f']
max_d = 0
for i in range(1, 8):
	d = {'f': nums[0], 'k': nums[1], 'c': nums[2]}
	point = i
	day = 0
	while True:
		d[week[point]] -= 1
		if d[week[point]] == -1:
			max_d = max(max_d, day)
			break
		day += 1
		if point != 7:
			point += 1
			continue
		if point == 7:
			point = 1
print(max_d + x * 7)


amounts = list(map(int, input().split()))
schedule = [0, 1, 2, 0, 2, 1, 0]
max_days = 0
for start_day in range(0, 7):
	numbers = amounts.copy()
	days = 0
	for day in range(start_day, 7):
		if numbers[schedule[day]] != 0:
			numbers[schedule[day]] -= 1
			days += 1
		else:
			break
	else:
		weeks = min(numbers[0] // 3, numbers[1] // 2, numbers[2] // 2)
		days += weeks * 7
		numbers[0] -= weeks * 3
		numbers[1] -= weeks * 2
		numbers[2] -= weeks * 2
		for day in range(0, 7):
			if numbers[schedule[day]] != 0:
				numbers[schedule[day]] -= 1
				days += 1
			else:
				break
	max_days = max(max_days, days)
print(max_days)


line = input()
(a, b, c) = list(map(int, line.split()))
n = min(a // 3, b // 2, c // 2)
a -= 3 * n
b -= 2 * n
c -= 2 * n
lst = 'abcacbaabcacbaabcacba'
res = 0
for i in range(7):
	n_days = 0
	(cur_a, cur_b, cur_c) = (a, b, c)
	for ch in lst[i:]:
		if ch == 'a':
			cur_a -= 1
			if cur_a < 0:
				break
		elif ch == 'b':
			cur_b -= 1
			if cur_b < 0:
				break
		elif ch == 'c':
			cur_c -= 1
			if cur_c < 0:
				break
		n_days += 1
	res = max(res, 7 * n + n_days)
print(res)


a = [int(i) for i in input().split()]
days = [0, 1, 2, 0, 2, 1, 0]
week = min(a[0] // 3, a[1] // 2, a[2] // 2)
(a[0], a[1], a[2]) = (a[0] - week * 3, a[1] - week * 2, a[2] - week * 2)
m = 0
for day in range(7):
	b = a.copy()
	c = 0
	for this_day in range(7):
		if b[days[(day + this_day) % 7]] > 0:
			b[days[(day + this_day) % 7]] -= 1
			c += 1
		else:
			break
	if c > m:
		m = c
print(m + week * 7)


g = [0, 0, 1, 2, 0, 2, 1]
num = [3, 2, 2]
List = list(map(int, input().split()))
days = 0
new = [List[0] / num[0], List[1] / num[1], List[2] / num[2]]
ga = [int(List[0] / num[0]), int(List[1] / num[1]), int(List[2] / num[2])]
week = min(ga)
k = []
for i in range(0, 3):
	k += [List[i] - week * num[i]]
md = 0
for s in range(0, 7):
	temp = list(k)
	spot = s
	days = 0
	while True:
		spot = spot % 7
		temp[g[spot]] -= 1
		if min(temp) < 0:
			break
		days += 1
		spot += 1
	if md < days:
		md = days
print(int(week * 7 + md))


def fun(f, r, c, d):
	i = d
	while 1:
		if i % 7 == 1 or i % 7 == 4 or i % 7 == 0:
			f -= 1
		elif i % 7 == 2 or i % 7 == 6:
			r -= 1
		else:
			c -= 1
		if f < 0 or c < 0 or r < 0:
			break
		else:
			i += 1
	return i - d
(f, r, c) = map(int, input().split())
l = min(int(f / 3), int(r / 2), int(c / 2))
f = f - 3 * l
r = r - 2 * l
c = c - 2 * l
s = 0
for j in range(1, 8):
	if fun(f, r, c, j) >= s:
		s = fun(f, r, c, j)
print(s + 7 * l)


m = list(map(int, input().split()))
(a, b, c) = m
full = min(a // 3, b // 2, c // 2)
a -= 3 * full
b -= 2 * full
c -= 2 * full
(m[0], m[1], m[2]) = (a, b, c)
t = (1, 2, 3, 1, 3, 2, 1)
ans = 0
for c in range(7):
	a = 0
	tm = m[:]
	while tm[t[c] - 1] > 0:
		tm[t[c] - 1] -= 1
		a += 1
		c = (c + 1) % 7
	ans = max(a, ans)
print(7 * full + ans)


IN = input().split()
A = [0] * 3
for i in range(0, 3):
	A[i] = int(IN[i])
co = [0, 1, 2, 0, 2, 1, 0]
ile = [3, 2, 2]
res = 0
for i in range(0, 7):
	full = min(A[0] // 3, A[1] // 2, A[2] // 2)
	for j in range(0, 3):
		A[j] -= full * ile[j]
	ans = 7 * full
	dod = 0
	for j in range(0, 7):
		if A[co[j]] == 0:
			dod = j
			break
		A[co[j]] -= 1
	res = max(res, ans + dod - i)
	for j in range(0, dod):
		A[co[j]] += 1
	for j in range(0, 3):
		A[j] += full * ile[j]
	A[co[i]] += 1
print(res)


(a, b, c) = [int(x) for x in input().split(' ')]
(ans, x, y) = (0, 0, 0)
d = min(a // 3, b // 2, c // 2)
a -= d * 3
b -= d * 2
c -= d * 2
(aa, bb, cc) = (a, b, c)
for i in range(1, 8):
	x = 0
	f = 0
	(a, b, c) = (aa, bb, cc)
	if i < 8:
		for j in range(i, 8):
			if j == 1:
				a -= 1
				if a < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif a >= 0:
					x += 1
			if j == 2:
				a -= 1
				if a < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif a >= 0:
					x += 1
			if j == 3:
				b -= 1
				if b < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif b >= 0:
					x += 1
			if j == 4:
				c -= 1
				if c < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif c >= 0:
					x += 1
			if j == 5:
				a -= 1
				if a < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif a >= 0:
					x += 1
			if j == 6:
				c -= 1
				if c < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif c >= 0:
					x += 1
			if j == 7:
				b -= 1
				if b < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif b >= 0:
					x += 1
	if f == 1:
		continue
	if i > 1:
		for j in range(1, i):
			if j == 1:
				a -= 1
				if a < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif a >= 0:
					x += 1
			if j == 2:
				a -= 1
				if a < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif a >= 0:
					x += 1
			if j == 3:
				b -= 1
				if b < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif b >= 0:
					x += 1
			if j == 4:
				c -= 1
				if c < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif c >= 0:
					x += 1
			if j == 5:
				a -= 1
				if a < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif a >= 0:
					x += 1
			if j == 6:
				c -= 1
				if c < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif c >= 0:
					x += 1
			if j == 7:
				b -= 1
				if b < 0:
					ans = max(ans, 7 * d + x)
					f = 1
					break
				elif b >= 0:
					x += 1
print(ans)


import copy
nums = [0, 1, 2, 0, 2, 1, 0]
asdf = [3, 2, 2]
things = list(map(int, input().split(' ')))
max_idx = 0
for i in range(7):
	stuff = copy.deepcopy(things)
	idx = i
	while stuff[0] >= 0 and stuff[1] >= 0 and (stuff[2] >= 0) and (idx < 7):
		stuff[nums[idx % 7]] -= 1
		idx += 1
	num_weeks = min([stuff[0] // asdf[0], stuff[1] // asdf[1], stuff[2] // asdf[2]])
	stuff[0] -= asdf[0] * num_weeks
	stuff[1] -= asdf[1] * num_weeks
	stuff[2] -= asdf[2] * num_weeks
	idx += 7 * num_weeks
	while stuff[0] >= 0 and stuff[1] >= 0 and (stuff[2] >= 0):
		stuff[nums[idx % 7]] -= 1
		idx += 1
	idx -= i
	if max_idx < idx:
		max_idx = idx
print(max_idx - 1)


(a, b, c) = list(map(int, input().split()))
jam = {}
kj = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']
kj.extend(kj)
gh = ['a', 'a', 'b', 'c', 'a', 'c', 'b']
gh.extend(gh)
am = []
aa = a
bb = b
cc = c
for it in kj:
	sam = 1
	nam = kj.index(it)
	jim = gh[nam]
	him = kj[nam]
	if jim == 'a':
		aa -= 1
	elif jim == 'b':
		bb -= 1
	else:
		cc -= 1
	nam += 1
	don = 1
	ds = 0
	while sam <= 7:
		if kj[nam] == him:
			break
		else:
			jim = gh[nam]
			if jim == 'a' and aa > 0:
				don += 1
				aa -= 1
			elif jim == 'b' and bb > 0:
				don += 1
				bb -= 1
			elif jim == 'c' and cc > 0:
				don += 1
				cc -= 1
			else:
				ds = 1
				break
		sam += 1
		nam += 1
	if ds == 1:
		am.append(don)
		aa = a
		bb = b
		cc = c
	else:
		ad = aa // 3
		bd = bb // 2
		cd = cc // 2
		dim = min(ad, bd, cd)
		don += 7 * dim
		aa -= 3 * dim
		bb -= 2 * dim
		cc -= 2 * dim
		sam = 1
		nam = kj.index(it)
		jim = gh[nam]
		him = kj[nam]
		ds = 0
		nam += 1
		while sam <= 7:
			jim = gh[nam]
			him = kj[nam]
			if jim == 'a' and aa > 0:
				don += 1
				aa -= 1
			elif jim == 'b' and bb > 0:
				don += 1
				bb -= 1
			elif jim == 'c' and cc > 0:
				don += 1
				cc -= 1
			else:
				ds = 1
				break
			sam += 1
			nam += 1
	am.append(don)
	aa = a
	bb = b
	cc = c
print(max(am))


def getMax(a, b, c):
	dayToNeed = {0: 0, 1: 0, 2: 1, 3: 2, 4: 0, 5: 2, 6: 1}
	result = 0
	for day in range(7):
		cur = day
		available = [a, b, c]
		curCount = 0
		while True:
			curNeed = dayToNeed[cur]
			if available[curNeed] == 0:
				break
			available[curNeed] -= 1
			curCount += 1
			cur = (cur + 1) % 7
			if cur == day:
				break
		result = max(curCount, result)
	return result
(a, b, c) = map(int, input().split())
weeksDone = min(a // 3, b // 2, c // 2)
result = weeksDone * 7
newA = min(3, a - weeksDone * 3)
newB = min(2, b - weeksDone * 2)
newC = min(2, c - weeksDone * 2)
result += getMax(newA, newB, newC)
print(result)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
a = l()
days = [0, 1, 2, 0, 2, 1, 0]
m = min(a[0] // 3, a[1] // 2, a[2] // 2)
a[0] -= m * 3
a[1] -= m * 2
a[2] -= m * 2
answer = 0
for i in range(7):
	res = 0
	temp = a[:]
	while temp[days[i]] > 0:
		temp[days[i]] -= 1
		i = (i + 1) % 7
		res += 1
	answer = max(answer, m * 7 + res)
out(answer)


(a, b, c) = map(int, input().split())
w = min(a // 3, b // 2, c // 2)
a -= w * 3
b -= w * 2
c -= w * 2
week = [0, 1, 2, 0, 2, 1, 0]
mx = 0
for d in range(7):
	cnt = 0
	korm = [a, b, c]
	while True:
		if korm[week[d]] > 0:
			korm[week[d]] -= 1
			d = (d + 1) % 7
			cnt += 1
		else:
			mx = max(cnt, mx)
			break
print(mx + w * 7)


List = list(map(int, input().split()))
dc = {}
d = {}
cmax = 0
count = 0
s = ['a', 'b', 'c', 'a', 'c', 'b', 'a']
i = 0
p = 0
m = min(List[0] // 3, List[1] // 2, List[2] // 2)
List[0] -= 3 * m
List[1] -= 2 * m
List[2] -= 2 * m
p += 7 * m
for i in range(0, 7):
	j = i
	d['a'] = List[0]
	d['b'] = List[1]
	d['c'] = List[2]
	count = 0
	while True:
		j %= 7
		if d[s[j]] >= 1:
			d[s[j]] -= 1
			count += 1
		else:
			if cmax < count:
				cmax = count
			break
		j += 1
print(cmax + p)


(a, b, c) = map(int, input().split())
st = [[0, 0, 0], [2, 2, 2], [2, 1, 2], [2, 1, 1], [1, 1, 1], [1, 1, 0], [1, 0, 0]]
week = [3, 2, 2]
week1 = [1, 2, 3, 1, 3, 2, 1]
(r1, r2, r3) = (a, b, c)
days = 0
for i in range(7):
	d = 0
	(a, b, c) = (r1, r2, r3)
	d += 7 * min(a // week[0], b // week[1], c // week[2])
	a -= week[0] * (d // 7)
	b -= week[1] * (d // 7)
	c -= week[2] * (d // 7)
	ok = 1
	day = (i + d) % 7
	add = 0
	while ok:
		if week1[(day + add) % 7] == 1:
			if a > 0:
				a -= 1
				add += 1
			else:
				ok = 0
		elif week1[(day + add) % 7] == 2:
			if b > 0:
				b -= 1
				add += 1
			else:
				ok = 0
		elif week1[(day + add) % 7] == 3:
			if c > 0:
				c -= 1
				add += 1
			else:
				ok = 0
	if d + add > days:
		days = d + add
print(days)


import sys
import copy
line = sys.stdin.readline().strip('\n')
num = list(map(int, line.split()))
round = min([num[0] // 3, num[1] // 2, num[2] // 2])
(num[0], num[1], num[2]) = (num[0] - round * 3, num[1] - round * 2, num[2] - round * 2)
id = [0, 1, 2, 0, 2, 1, 0]
ret = 0
for i in range(7):
	tnum = copy.deepcopy(num)
	for j in range(7):
		tnum[id[(i + j) % 7]] -= 1
		if tnum[id[(i + j) % 7]] < 0:
			ret = max(j, ret)
			break
ret = ret + round * 7
print(ret)


ln = [int(i) for i in input().split(' ')]
oln = ln.copy()
st = 'abcacba'
inds = ['a', 'b', 'c']
mx = 0
for i in range(0, 7):
	ln = oln.copy()
	n = min(ln[0] // 3, ln[1] // 2, ln[2] // 2)
	ln[0] -= n * 3
	ln[1] -= n * 2
	ln[2] -= n * 2
	m = n * 7
	for j in range(0, len(st)):
		if ln[inds.index(st[j])] > 0:
			m += 1
			ln[inds.index(st[j])] -= 1
		else:
			break
	mx = max(mx, m)
	st = ''.join(list(st)[1:] + [list(st)[0]])
print(mx)


class Wrapper:

	def __init__(self, val):
		self.val = val
list_ints = [int(x) for x in input().split()]
a = list_ints[0]
b = list_ints[1]
c = list_ints[2]
weeks = min(a // 3, b // 2, c // 2)
longest = 0
chosen = 0
for start_day in range(7):
	cur = 0
	a_left = Wrapper(a % 3 if a // 3 <= weeks else 3)
	b_left = Wrapper(b % 2 if b // 2 <= weeks else 2)
	c_left = Wrapper(c % 2 if c // 2 <= weeks else 2)
	food_dict = {0: a_left, 1: b_left, 2: c_left, 3: a_left, 4: c_left, 5: b_left, 6: a_left}
	day = start_day
	while food_dict[day].val != 0:
		food = food_dict[day]
		food_dict[day].val -= 1
		day = (day + 1) % 7
		cur += 1
		if cur > longest:
			longest = cur
			chosen = start_day
print(weeks * 7 + longest)


(a, b, c) = map(int, input().split())
week = min(a // 3, b // 2, c // 2)
(bon, temp, day) = (0, 0, 0)
for i in range(7):
	aa = a - 3 * week
	bb = b - 2 * week
	cc = c - 2 * week
	temp = 0
	day = i
	while True:
		if day % 7 == 0:
			if aa > 0:
				aa -= 1
			else:
				break
		elif day % 7 == 1:
			if bb > 0:
				bb -= 1
			else:
				break
		elif day % 7 == 2:
			if cc > 0:
				cc -= 1
			else:
				break
		elif day % 7 == 3:
			if aa > 0:
				aa -= 1
			else:
				break
		elif day % 7 == 4:
			if cc > 0:
				cc -= 1
			else:
				break
		elif day % 7 == 5:
			if bb > 0:
				bb -= 1
			else:
				break
		elif day % 7 == 6:
			if aa > 0:
				aa -= 1
			else:
				break
		temp += 1
		day += 1
	bon = max(bon, temp)
print(bon + week * 7)


stock = list(map(int, input().split()))
seq = [0, 1, 2, 0, 2, 1, 0]
poss = []
for i in range(0, 7):
	tstock = [] + stock
	sd = 0
	for j in range(i, 7):
		if tstock[seq[j]] > 0:
			tstock[seq[j]] -= 1
			sd += 1
		else:
			break
	sw = min(tstock[0] // 3, tstock[1] // 2, tstock[2] // 2)
	tstock[0] -= sw * 3
	tstock[1] -= sw * 2
	tstock[2] -= sw * 2
	for j in range(0, 7):
		if tstock[seq[j]] > 0:
			tstock[seq[j]] -= 1
			sd += 1
		else:
			break
	poss.append(sw * 7 + sd)
print(max(poss))


(f, r, c) = map(int, input().split())
(s, e, ans) = (0, 10 ** 9, 0)
while s <= e:
	mid = s + (e - s) // 2
	if 3 * mid <= f and 2 * mid <= r and (2 * mid <= c):
		s = mid + 1
		ans = mid
	else:
		e = mid - 1
add = 0
week = [0, 1, 2, 0, 2, 1, 0]
for i in range(0, len(week)):
	food = [f - ans * 3, r - ans * 2, c - ans * 2]
	cnt = 0
	j = i
	while True:
		food[week[j]] -= 1
		if food[week[j]] < 0:
			break
		cnt += 1
		add = max(add, cnt)
		j = j + 1
		if j >= len(week):
			j = 0
print(ans * 7 + add)


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) = map(int, input().split())
num = 7 * min(a // 3, b // 2, c // 2)
a -= num // 7 * 3
b -= num // 7 * 2
c -= num // 7 * 2
al = 0
for i in range(1, 8):
	k = 0
	a1 = a
	b1 = b
	c1 = c
	for j in range(i + 1, i + 7):
		if j % 7 == 1 or j % 7 == 4 or j % 7 == 0:
			a1 -= 1
			if a1 == -1:
				break
		if j % 7 == 2 or j % 7 == 6:
			b1 -= 1
			if b1 == -1:
				break
		if j % 7 == 3 or j % 7 == 5:
			c1 -= 1
			if c1 == -1:
				break
		k += 1
	if k > al:
		al = k
print(num + al)


R = lambda : map(int, input().split())

def solve():
	che = [1, 2, 3, 1, 3, 2, 1]
	(a, b, c) = R()
	mifo = min(a // 3, min(b // 2, c // 2))
	a -= mifo * 3
	b -= mifo * 2
	c -= mifo * 2
	mda = mifo * 7
	mday = 0
	for i in range(8):
		che.append(che[0])
		che.pop(0)
		(x, y, z) = (a, b, c)
		day = 0
		for j in che:
			if j == 1:
				x -= 1
			elif j == 2:
				y -= 1
			else:
				z -= 1
			if x >= 0 and y >= 0 and (z >= 0):
				day += 1
			if x == 0 or y == 0 or z == 0:
				mday = max(mday, day)
	print(mda + mday)
solve()


n = list(map(int, input().split()))
f = n[0]
r = n[1]
c = n[2]
food = ['f', 'r', 'c', 'f', 'c', 'r', 'f']
an = 0
week_count = min(f // 3, r // 2, c // 2)
an += week_count * 7
rf = f - week_count * 3
rr = r - week_count * 2
rc = c - week_count * 2
ans = 0
for i in range(0, 7):
	remain = dict()
	remain['f'] = rf + 0
	remain['r'] = rr + 0
	remain['c'] = rc + 0
	curday = i
	max_day = 0
	posi = True
	while posi:
		curfood = food[curday % 7]
		if remain[curfood] == 0:
			posi = False
		else:
			remain[curfood] -= 1
			max_day += 1
			curday += 1
	ans = max_day if ans < max_day else ans
print(ans + an)


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(a, b, c) = map(int, input().split())
a1 = a // 3
b1 = b // 2
c1 = c // 2
ans = min(a1, b1, c1)
a -= ans * 3
b -= ans * 2
c -= ans * 2
if a == 0:
	if b >= 1:
		if c >= 1:
			print(ans * 7 + 2)
		else:
			print(ans * 7 + 1)
	elif c >= 1:
		print(ans * 7 + 1)
	else:
		print(ans * 7)
elif b == 0:
	if c >= 2:
		print(ans * 7 + 3)
	else:
		print(ans * 7 + 2)
elif c == 0:
	if a == 1:
		print(ans * 7 + 2)
	elif b == 1:
		print(ans * 7 + 3)
	else:
		print(ans * 7 + 4)
elif a == 1:
	if b == 1:
		if c == 1:
			print(ans * 7 + 3)
		else:
			print(ans * 7 + 4)
	elif c == 1:
		print(ans * 7 + 3)
	else:
		print(ans * 7 + 5)
elif a == 2:
	if b >= 2:
		if c >= 2:
			print(ans * 7 + 6)
		elif c == 1:
			print(ans * 7 + 5)
	elif b == 1:
		if c >= 1:
			print(ans * 7 + 4)
		else:
			print(ans * 7 + 3)
elif b == 1:
	if c >= 2:
		print(ans * 7 + 6)
	elif c == 1:
		print(ans * 7 + 6)
elif c == 1:
	print(ans * 7 + 6)


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


(a, b, c) = list(map(int, input().split()))
w = 0
m = []
for i in range(1, 8):
	d = i
	(at, bt, ct) = (a, b, c)
	while d < 8:
		if d % 7 in (1, 4, 0):
			if at == 0:
				break
			else:
				at -= 1
		elif d % 7 in (2, 6):
			if bt == 0:
				break
			else:
				bt -= 1
		elif ct == 0:
			break
		else:
			ct -= 1
		d += 1
	m.append([d - i, [at, bt, ct], d])
t = []
for (d, f, _) in m:
	(at, bt, ct) = (f[0], f[1], f[2])
	w = 0
	if at >= 3 and bt >= 2 and (ct >= 2):
		w = min(at // 3, bt // 2, ct // 2)
		at -= 3 * w
		bt -= 2 * w
		ct -= 2 * w
	t.append([d + w * 7, [at, bt, ct], _])
ans = []
for (_, f, d) in t:
	i = d
	(at, bt, ct) = (f[0], f[1], f[2])
	while True:
		if i % 7 in (1, 4, 0):
			if at == 0:
				break
			else:
				at -= 1
		elif i % 7 in (2, 6):
			if bt == 0:
				break
			else:
				bt -= 1
		elif ct == 0:
			break
		else:
			ct -= 1
		i += 1
	ans.append(_ + i - d)
print(max(ans))


g = [0, 1, 2, 0, 2, 1, 0]
a = list(map(int, input().split()))
ans = 0
for i in range(7):
	b = a.copy()
	cnt = 0
	good = 1
	for j in range(i, 7):
		if b[g[j]] > 0:
			b[g[j]] -= 1
			cnt += 1
		else:
			good = 0
			break
	if good:
		x = min(b[0] // 3, b[1] // 2, b[2] // 2)
		cnt += x * 7
		b[0] -= 3 * x
		b[1] -= 2 * x
		b[2] -= 2 * x
		for j in range(7):
			if b[g[j]] > 0:
				cnt += 1
				b[g[j]] -= 1
			else:
				break
	ans = max(ans, cnt)
print(ans)


(a, b, c) = map(int, input().split())
(x, y, z) = (a, b, c)
l = ['aabcacb', 'abcacba', 'bcacbaa', 'cacbaab', 'acbaabc', 'cbaabca', 'baabcac']
d = {'a': a, 'b': b, 'c': c}
m = []
for i in range(7):
	t = 0
	j = 0
	while j < 7:
		if d[l[i][j]] == 0:
			break
		else:
			d[l[i][j]] -= 1
			t += 1
		if j == 6 and d[l[i][0]] > 0:
			a1 = d['a'] // 3
			a2 = d['b'] // 2
			a3 = d['c'] // 2
			p = min(a1, a2, a3)
			t += 7 * p
			d['a'] -= 3 * p
			d['b'] -= 2 * p
			d['c'] -= 2 * p
			j = 0
		else:
			j += 1
	m.append(t)
	d['a'] = x
	d['b'] = y
	d['c'] = z
print(max(m))


def solve(a, b, c):
	small = min(int(a / 3), int(b / 2), int(c / 2))
	totalDay = small * 7
	a = a - small * 3
	b = b - small * 2
	c = c - small * 2
	if a == 0:
		totalDay = totalDay + int(b > 0) + int(c > 0)
	elif a == 1:
		totalDay = totalDay + 1
		if c > 1:
			totalDay = totalDay + 2
			totalDay = totalDay + int(b > 0) + int(b > 1)
		elif c > 0:
			totalDay = totalDay + 1
			totalDay = totalDay + int(b > 0)
		else:
			totalDay = totalDay + int(b > 0)
	elif a == 2:
		totalDay = totalDay + 2
		if b > 1:
			totalDay = totalDay + 2 + int(c > 0) + int(c > 1)
		elif b > 0:
			totalDay = totalDay + 1 + int(c > 1) + int(c > 0)
		elif c > 2:
			totalDay = totalDay + 1
	elif b != 0 and c != 0:
		totalDay = totalDay + 3 + 2 + int(b > 1) + int(c > 1)
	elif b == 0:
		totalDay = max(totalDay + 1 + int(c > 0) + int(c > 1), totalDay + 2)
	elif c == 0:
		totalDay = totalDay + 2 + int(b > 0) + int(b > 1)
	else:
		totalDay = totalDay + 2
	return totalDay
(a, b, c) = [int(s) for s in input().split()]
print(solve(a, b, c))


(a, b, c) = map(int, input().split())
mn = min(a // 3, b // 2, c // 2)
res = mn
a -= mn * 3
b -= mn * 2
c -= mn * 2
dic = {1: 'a', 2: 'b', 3: 'c', 4: 'a', 5: 'c', 6: 'b', 7: 'a'}
take = []
check = 0
take1 = a
take2 = b
take3 = c
for i in range(1, 8):
	a = take1
	b = take2
	c = take3
	ans = 0
	j = i
	while True:
		if dic[j] == 'a' and a > 0:
			a -= 1
			ans += 1
			j += 1
			if j == 8:
				j = 1
		elif dic[j] == 'b' and b > 0:
			b -= 1
			ans += 1
			j += 1
			if j == 8:
				j = 1
		elif dic[j] == 'c' and c > 0:
			c -= 1
			ans += 1
			j += 1
			if j == 8:
				j = 1
		else:
			break
	take.append(ans)
print(res * 7 + max(take))


def func(a, b, c, d):
	count = d
	days = 0
	flag = 0
	while flag == 0:
		if count == 0 or count == 3 or count == 6:
			if a == 0:
				flag = 1
				break
			else:
				a -= 1
		elif count == 1 or count == 5:
			if b == 0:
				flag = 1
				break
			else:
				b -= 1
		elif c == 0:
			flag = 1
			break
		else:
			c -= 1
		count += 1
		count = count % 7
		days += 1
	return days
(a, b, c) = map(int, input().split())
ans = 0
val = min(a // 3, min(b // 2, c // 2))
a -= val * 3
b -= val * 2
c -= val * 2
for i in range(7):
	ans = max(ans, val * 7 + func(a, b, c, i))
print(ans)


(a, b, c) = map(int, input().split())
a_ar = [[3, 5, 4, 3, 3, 2, 1], [6, 6, 5, 4, 6, 5, 4], [7, 9, 8, 7, 9, 8, 7]]
b_ar = [[5, 4, 6, 5, 4, 3, 6], [8, 7, 10, 9, 8, 7, 9]]
c_ar = [[4, 3, 2, 6, 5, 6, 5], [9, 8, 7, 8, 7, 11, 10]]
am = (a - 1) // 3 * 7
bm = (b - 1) // 2 * 7
cm = (c - 1) // 2 * 7
ap = (a - 1) % 3
bp = (b - 1) % 2
cp = (c - 1) % 2
d = max([min(am + a_ar[ap][i], bm + b_ar[bp][i], cm + c_ar[cp][i]) for i in range(7)])
print(d)


d = '12313211231321'
(a, b, c) = map(int, input().split())
k = min(a // 3, b // 2, c // 2)
a -= k * 3
b -= k * 2
c -= k * 2
t = 0
day = 0
while t < 7:
	(a1, b1, c1) = (a, b, c)
	r = t
	w = 0
	while True:
		if d[r] == '1':
			a1 -= 1
		if d[r] == '2':
			b1 -= 1
		if d[r] == '3':
			c1 -= 1
		if a1 < 0 or b1 < 0 or c1 < 0:
			break
		w += 1
		r += 1
	day = max(day, w)
	t += 1
print(k * 7 + day)


import copy
supplies = list(map(int, input().split()))
min_weeks = min(supplies[0] // 3, supplies[1] // 2, supplies[2] // 2)
supplies = [supplies[0] - 3 * min_weeks, supplies[1] - 2 * min_weeks, supplies[2] - 2 * min_weeks]
food_dict = [0, 0, 1, 2, 0, 2, 1]
max_days_left = 0
for i in range(len(food_dict)):
	tmp_arr = copy.copy(supplies)
	curr_days = 0
	for j in range(len(food_dict)):
		day = (i + j) % 7
		if tmp_arr[food_dict[day]]:
			curr_days += 1
			tmp_arr[food_dict[day]] -= 1
		else:
			break
	max_days_left = max(max_days_left, curr_days)
print(min_weeks * 7 + max_days_left)


(a, b, c) = map(int, input().split())
s = 'abcacba' * 2

def solve(a, b, c):
	n = min(a // 3, b // 2, c // 2)
	day = 7 * n
	a -= 3 * n
	b -= 2 * n
	c -= 2 * n
	res = 0
	i = j = 0
	d = {'a': a, 'b': b, 'c': c}
	while i < len(s):
		if d[s[j]]:
			d[s[j]] -= 1
			j += 1
		else:
			res = max(res, j - i)
			while not d[s[j]]:
				d[s[i]] += 1
				i += 1
		if j >= len(s):
			break
	return day + res
print(solve(a, b, c))


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


def func():
	from bisect import bisect_left as bl
	(a, b, c) = [int(i) for i in input().split()]
	fish = [1, 4, 7, 1, 4, 7]
	rab = [2, 6, 2, 6]
	chick = [3, 5, 3, 5]
	days = []
	for i in range(1, 8):
		f = -1
		for j in range(len(fish)):
			if fish[j] >= i:
				f = j
				break
		print('f', f)
		wf = a // 3
		rem = a % 3 - 1
		toc = fish[f + rem] - fish[f]
		if toc < 0:
			toc += 8
		tot_f = wf * 7 + toc
		print('wf', wf, 'rem', rem, 'tot_f', tot_f)
		r = -1
		for j in range(len(rab)):
			if rab[j] >= i:
				r = j
				break
		wr = b // 2
		rem = b % 2 - 1
		toc = rab[r + rem] - rab[r]
		if toc < 0:
			toc += 8
		tot_r = wr * 7 + toc
		ch = -1
		for j in range(len(chick)):
			if chick[j] >= i:
				ch = j
				break
		wc = a // 2
		ram = a % 2 - 1
		toc = chick[ch + ram] - chick[ch]
		if toc < 0:
			toc += 8
		tot_c = wc * 7 + toc
		days.append(min(tot_f, tot_r, tot_c))
	print(*days)

def solve():
	(a, b, c) = [int(i) for i in input().split()]
	wa = a // 3
	wb = b // 2
	wc = c // 2
	wks = min(wa, wb, wc)
	a -= wks * 3
	b -= wks * 2
	c -= wks * 2
	ans = 0
	for i in range(1, 8):
		(acp, bcp, ccp) = (a, b, c)
		for j in range(i, i + 7):
			val = j % 7
			if val == 1 or val == 4 or val == 0:
				if acp == 0:
					break
				acp -= 1
			elif val == 2 or val == 6:
				if bcp == 0:
					break
				bcp -= 1
			else:
				if ccp == 0:
					break
				ccp -= 1
		ans = max(ans, j - i)
	ans += wks * 7
	print(ans)
solve()


x = list(map(int, input().split()))
a = []
total_time = 0
(a.append(x[0] // 3), a.append(x[1] // 2), a.append(x[2] // 2))
if x[0] >= 3 and x[1] >= 2 and (x[2] >= 2):
	x[0] -= 3 * min(a)
	x[1] -= 2 * min(a)
	x[2] -= 2 * min(a)
	total_time = min(a) * 7
if x[0] != 0 and x[1] != 0 and (x[2] != 0):
	if x[0] == 1 and x[1] == 1 and (x[2] == 1) or (x[0] == 1 and x[1] >= 2 and (x[2] == 1)):
		total_time += 3
	elif x[0] == 2 and x[1] == 1 and (x[2] == 1) or (x[0] == 2 and x[1] == 1 and (x[2] >= 2)) or (x[0] == 1 and x[1] == 1 and (x[2] >= 2)):
		total_time += 4
	elif x[0] >= 3 and x[1] == 1 and (x[2] == 1) or (x[0] == 1 and x[1] >= 2 and (x[2] >= 2)) or (x[0] == 2 and x[1] >= 2 and (x[2] == 1)):
		total_time += 5
	elif x[0] == 2 and x[1] >= 2 and (x[2] >= 2) or (x[0] >= 3 and x[1] >= 2 and (x[2] == 1)) or (x[0] >= 3 and x[1] == 1 and (x[2] >= 2)):
		total_time += 6
if x[0] == 0 or x[1] == 0 or x[2] == 0:
	if x[0] == 1 and x[1] == 1 or (x[0] == 1 and x[2] == 1) or (x[1] == 1 and x[2] == 1):
		total_time += 2
	elif x[0] >= 2 and x[2] == 1 or (x[1] >= 2 and x[0] == 1) or (x[1] == 1 and x[2] == 1) or (x[1] == 1 and x[2] >= 2) or (x[1] >= 2 and x[2] == 1) or (x[1] >= 2 and x[2] >= 2):
		total_time += 2
	elif x[1] == 1 and x[0] >= 2 or (x[0] == 1 and x[2] >= 2) or (x[0] >= 2 and x[2] >= 2):
		total_time += 3
	elif x[0] >= 2 and x[1] >= 2:
		total_time += 4
if x[0] == 0 and x[1] == 0 or (x[0] == 0 and x[2] == 0) or (x[1] == 0 and x[2] == 0):
	if x[0] >= 2:
		total_time += 2
	elif x[0] != 0 and x[1] != 0 and (x[2] != 0):
		total_time += 1
print(total_time)


(a, b, c) = map(int, input().strip().split())
a1 = a // 3
b1 = b // 2
c1 = c // 2
mn = min([a1, b1, c1])
arr = [1, 1, 2, 3, 1, 3, 2]
maxdays = 0
for i in range(7):
	a2 = a - mn * 3
	b2 = b - mn * 2
	c2 = c - mn * 2
	days = 0
	for j in range(7):
		ix = (i + j) % 7
		if arr[ix] == 1:
			if a2 == 0:
				break
			else:
				a2 -= 1
				days += 1
		elif arr[ix] == 2:
			if b2 == 0:
				break
			else:
				b2 -= 1
				days += 1
		elif arr[ix] == 3:
			if c2 == 0:
				break
			else:
				c2 -= 1
				days += 1
	if days > maxdays:
		maxdays = days
print(mn * 7 + maxdays)


(a, b, c) = map(int, input().split(' '))
semaine = [0, 1, 2, 0, 2, 1, 0]

def temps_semaine(a, b, c):
	tpsa = a // 3
	tpsb = b // 2
	tpsc = c // 2
	tps = min([tpsa, tpsb, tpsc])
	a -= 3 * tps
	b -= 2 * tps
	c -= 2 * tps
	return [tps, [a, b, c]]

def temps(a, b, c):
	T = temps_semaine(a, b, c)
	tps = T[0]
	tpsmin = 0
	for k in range(7):
		abis = T[1][0]
		bbis = T[1][1]
		cbis = T[1][2]
		j = k
		tp = 0
		while not (semaine[j] == 0 and abis == 0) and (not (semaine[j] == 1 and bbis == 0)) and (not (semaine[j] == 2 and cbis == 0)):
			if semaine[j] == 0:
				abis -= 1
				tp += 1
			elif semaine[j] == 1:
				bbis -= 1
				tp += 1
			else:
				cbis -= 1
				tp += 1
			j = (j + 1) % 7
		if tp > tpsmin:
			tpsmin = tp
	return tpsmin + tps * 7
print(temps(a, b, c))


l = list(map(int, input().rstrip().split()))
g = min(l[0] // 3, l[2] // 2, l[1] // 2)
l[0] -= 3 * g
l[1] -= 2 * g
l[2] -= 2 * g
ans = 7 * g
p = [0, 1, 2, 0, 2, 1, 0]
maxi = 0
for i in range(7):
	l1 = []
	l1 = l1 + l
	loval = 0
	for j in range(7):
		if l1[p[(i + j) % 7]] > 0:
			l1[p[(i + j) % 7]] -= 1
			loval += 1
		else:
			maxi = max(loval, maxi)
			break
	maxi = max(loval, maxi)
print(ans + maxi)


(a, b, c) = map(int, input().split())
fu = 0
fu = min(a // 3, b // 2, c // 2)
a -= 3 * fu
b -= 2 * fu
c -= 2 * fu
x = [1, 2, 3, 1, 3, 2, 1]
k = 0
m = 0
for i in range(len(x)):
	d = 0
	f = 0
	j = i
	a1 = a
	b1 = b
	c1 = c
	z = 1
	while z == 1:
		k = x[j]
		if (k == 1) & (a1 > 0):
			a1 -= 1
			d += 1
		if (k == 2) & (b1 > 0):
			b1 -= 1
			d += 1
		if (k == 3) & (c1 > 0):
			c1 -= 1
			d += 1
		if d == f:
			z = 0
		else:
			f = d
			j += 1
			j = j % 7
	if d > m:
		m = d
print(7 * fu + m)


(a, b, c) = list(map(int, input().split()))
ans = 0
x = min(a // 3, b // 2, c // 2)
ans += 7 * x
(a, b, c) = (a - 3 * x, b - 2 * x, c - 2 * x)
s = (0, 1, 2, 0, 2, 1, 0)
sxmax = 0
for i in range(len(s)):
	xmax = 0
	(x, y, z) = (a, b, c)
	j = i
	while True:
		if s[j] == 0:
			x -= 1
		elif s[j] == 1:
			y -= 1
		elif s[j] == 2:
			z -= 1
		if x < 0 or y < 0 or z < 0:
			break
		xmax += 1
		j += 1
		j = j % 7
	sxmax = max(sxmax, xmax)
print(ans + sxmax)


food = [int(x) for x in input().split()]
day_to_food = {0: 0, 1: 1, 2: 2, 3: 0, 4: 2, 5: 1, 6: 0}
max_days = 0
weeks = min(food[0] // 3, food[1] // 2, food[2] // 2)
basic_days = 7 * weeks
food[0] -= 3 * weeks
food[1] -= 2 * weeks
food[2] -= 2 * weeks
for i in range(0, 7):
	food_copy = list(food)
	weekday = i
	days_passed = basic_days
	while True:
		if food_copy[day_to_food[weekday % 7]] > 0:
			food_copy[day_to_food[weekday % 7]] -= 1
			days_passed += 1
			weekday += 1
		else:
			if days_passed > max_days:
				max_days = days_passed
			break
print(max_days)


(a, b, c) = map(int, input().split())
weeks = min(a // 3, b // 2, c // 2)
a -= 3 * weeks
b -= 2 * weeks
c -= 2 * weeks
result = weeks * 7
if a >= 2 and b >= 2 and (c >= 2) or (a >= 3 and b >= 1 and (c >= 2)) or (a >= 3 and b >= 2 and (c >= 1)):
	print(result + 6)
elif a >= 2 and b >= 1 and (c >= 2) or (a >= 1 and b >= 2 and (c >= 2)) or (a >= 2 and b >= 1 and (c >= 2)) or (a >= 3 and b >= 1 and (c >= 1)) or (a >= 2 and b >= 2 and (c >= 1)):
	print(result + 5)
elif a >= 2 and b >= 1 and (c >= 1) or (a >= 1 and b >= 1 and (c >= 2)) or (a >= 2 and b >= 2):
	print(result + 4)
elif a >= 1 and b >= 1 and (c >= 1) or (a >= 2 and b >= 1) or (a >= 1 and c >= 2):
	print(result + 3)
elif a >= 2 or (a >= 1 and b >= 1) or (a >= 1 and c >= 1) or (b >= 1 and c >= 1):
	print(result + 2)
elif a >= 1 or b >= 1 or c >= 1:
	print(result + 1)
else:
	print(result)


l = list(map(int, input().split()))
a = l[0]
b = l[1]
c = l[2]
weekl = [1, 2, 3, 1, 3, 2, 1]
aa = a // 3
bb = b // 2
cc = c // 2
minus = min(aa, bb, cc)
a -= minus * 3
b -= minus * 2
c -= minus * 2
a_f = a
b_f = b
c_f = c
count_f = minus * 7
for ii in range(7):
	week = weekl[ii:] + weekl[:ii]
	a = a_f
	b = b_f
	c = c_f
	i = 0
	count = minus * 7
	while True:
		x = i % 7
		if week[x] == 1:
			a -= 1
			if a < 0:
				break
		elif week[x] == 2:
			b -= 1
			if b < 0:
				break
		else:
			c -= 1
			if c < 0:
				break
		i += 1
		count += 1
	count_f = max(count, count_f)
print(count_f)


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

def simulate(a, b, c, w):
	if w in [0, 3, 6]:
		if a > 0:
			a -= 1
		else:
			return 0
	if w in [1, 5]:
		if b > 0:
			b -= 1
		else:
			return 0
	if w in [2, 4]:
		if c > 0:
			c -= 1
		else:
			return 0
	return 1 + simulate(a, b, c, (w + 1) % 7)
print(d * 7 + max((simulate(a, b, c, w) for w in range(7))))


d = [-1, 0, 1, 2, 0, 2, 1, 0]
a = list(map(int, input().split()))
ans = 0
for i in range(1, 8):
	x = [a[0], a[1], a[2]]
	s = 0
	for j in range(i, 8):
		if x[d[j]] == 0:
			break
		x[d[j]] -= 1
		s += 1
	mn = 1e+18
	mn = min(mn, x[0] // 3)
	mn = min(mn, x[1] // 2)
	mn = min(mn, x[2] // 2)
	x[0] -= mn * 3
	x[1] -= mn * 2
	x[2] -= mn * 2
	t = mn * 7 + s
	ad = 0
	for j in range(1, 8):
		if x[d[j]] == 0:
			break
		x[d[j]] -= 1
		ad += 1
	ans = max(ans, t + ad)
print(ans)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	(a, b, c) = sep()
	ans = 10 ** 9
	ans = min(a // 3, b // 2, c // 2, ans)
	a -= ans * 3
	b -= ans * 2
	c -= ans * 2
	ans *= 7
	temp = min(a, b, c)
	ex = 0
	arr = [1, 1, 2, 3, 1, 3, 2]
	for i in range(7):
		temp = [a, b, c]
		curr = i
		day = 0
		while True:
			if temp[arr[curr % 7] - 1] > 0:
				temp[arr[curr % 7] - 1] -= 1
				curr += 1
				day += 1
			else:
				break
		ex = max(ex, day)
	print(ans + ex)
testcase(1)


def foo(a, b, c, i):
	i1 = i
	count = 0
	while 1:
		if i == 1 or i == 4 or i == 7:
			a = a - 1
		elif i == 2 or i == 6:
			b = b - 1
		elif i == 3 or i == 5:
			c = c - 1
		if a < 0 or b < 0 or c < 0:
			return count
		count = count + 1
		i = i + 1
		if i > 7:
			i = i % 7
(a, b, c) = map(int, input().split())
a1 = a // 3
b1 = b // 2
c1 = c // 2
d = min(a1, b1, c1)
if a > d:
	a -= d * 3
if b > d:
	b -= d * 2
if c > d:
	c -= d * 2
l = []
for i in range(1, 8):
	l.append(foo(a, b, c, i))
print(max(l) + 7 * d)


(a, b, c) = map(int, input().split())
res = 0
k = min(int(a / 3), int(b / 2), int(c / 2))
a -= k * 3
b -= k * 2
c -= k * 2
res += 7 * k

def f(arr, a, b, c):
	result = 0
	for i in arr:
		if i == 'a':
			if a == 0:
				return result
			else:
				a -= 1
				result += 1
		if i == 'b':
			if b == 0:
				return result
			else:
				b -= 1
				result += 1
		if i == 'c':
			if c == 0:
				return result
			else:
				c -= 1
				result += 1
arr = ['a', 'b', 'c', 'a', 'c', 'b', 'a']
n = len(arr)
x = [[arr[i - j] for i in range(n)] for j in range(n)]
res += max([f(arr_, a, b, c) for arr_ in x])
print(res)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		(a, b, c) = ria()
		f = a // 3
		r = b // 2
		ch = c // 2
		z = min(f, r, ch)
		nd = 7 * z
		arr = [0, 0, 0, 0, 0, 0, 0]
		nal = a - z * 3
		nbl = b - z * 2
		ncl = c - z * 2
		m = 0
		if nal >= 2 and nbl >= 2 and (ncl >= 2):
			m = 6
		elif nal >= 3 and nbl >= 1 and (ncl >= 2):
			m = 6
		elif nal >= 3 and nbl >= 2 and (ncl >= 1):
			m = 6
		elif nal >= 3 and nbl >= 1 and (ncl >= 1):
			m = 5
		elif nal >= 2 and nbl >= 2 and (ncl >= 1):
			m = 5
		elif nal >= 2 and nbl >= 1 and (ncl >= 2):
			m = 5
		elif nal >= 1 and nbl >= 2 and (ncl >= 2):
			m = 5
		elif nal >= 2 and nbl >= 1 and (ncl >= 1):
			m = 4
		elif nal >= 2 and nbl >= 2 and (ncl >= 0):
			m = 4
		elif nal >= 1 and nbl >= 1 and (ncl >= 2):
			m = 4
		elif nal >= 2 and nbl >= 1 and (ncl >= 0):
			m = 3
		elif nal >= 1 and nbl >= 1 and (ncl >= 1):
			m = 3
		elif nal >= 1 and nbl >= 0 and (ncl >= 2):
			m = 3
		elif nal >= 2:
			m = 2
		else:
			t = 0
			for i in [nal, nbl, ncl]:
				if i > 0:
					t += 1
			if t == 2:
				m = 2
			if t == 1:
				m = 1
		print(nd + m)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def solve():
	words = input().split()
	(a, b, c) = [int(i) for i in words]
	(na, nb, nc) = (a // 3, b // 2, c // 2)
	nmin = min([na, nb, nc])
	ret = nmin * 7
	a -= nmin * 3
	b -= nmin * 2
	c -= nmin * 2
	r = 0
	for sd in range(7):
		(ta, tb, tc) = (a, b, c)
		tr = 0
		for i in range(7):
			cday = (sd + i) % 7
			if cday in [0, 3, 6]:
				ta -= 1
			elif cday in [1, 5]:
				tb -= 1
			else:
				tc -= 1
			if ta < 0 or tb < 0 or tc < 0:
				break
			tr += 1
		r = max(r, tr)
	print(ret + r)
solve()


(a, b, c) = list(map(int, input().split()))
arr = [[1, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 0, 0], [0, 0, 1], [0, 1, 0]]
tt = 0
for i in range(0, 7):
	maxs = 0
	aa = a
	bb = b
	cc = c
	maxs += min(int(a / 3), int(b / 2), int(c / 2))
	aa -= maxs * 3
	bb -= maxs * 2
	cc -= maxs * 2
	t = 0
	a1 = 0
	b1 = 0
	c1 = 0
	for j in range(i, i + 8):
		a1 = a1 + arr[j % 7][0]
		b1 = b1 + arr[j % 7][1]
		c1 = c1 + arr[j % 7][2]
		if a1 <= aa and b1 <= bb and (c1 <= cc):
			t = max(t, abs(i - j) + 1)
	tt = max(tt, t + maxs * 7)
print(tt)


def line():
	return map(int, input().split())
(a, b, c) = line()
q = min(a // 3, b // 2, c // 2)
(a, b, c) = (a - q * 3, b - q * 2, c - q * 2)
x = 0
for w in range(7):
	(r, t, y) = (a, b, c)
	g = 0
	for e in range(7):
		if (w + e) % 7 in [0, 3, 6]:
			r -= 1
		elif (w + e) % 7 in [1, 5]:
			t -= 1
		else:
			y -= 1
		if r < 0 or t < 0 or y < 0:
			g = e
			break
	x = max(x, g)
print(q * 7 + x)


n = list(map(int, input().split()))
(f, r, c) = (n[0], n[1], n[2])
if r > c:
	k = c // 2
else:
	k = r // 2
if f < k * 3:
	nf = f % 3
	f = f - nf
	k = f // 3
	nr = r - 2 * k
	nc = c - 2 * k
else:
	nf = f - 3 * k
	nr = r - 2 * k
	nc = c - 2 * k
f = nf
r = nr
c = nc
s = 7 * k
sd = []
for i in range(7):
	a = f
	b = r
	d = c
	j = 0
	h = i
	tt = True
	while j < 7 and tt:
		if h % 3 == 0:
			if a == 0:
				tt = False
			else:
				a -= 1
		elif h == 1 or h == 5:
			if b == 0:
				tt = False
			else:
				b -= 1
		elif h == 2 or h == 4:
			if d == 0:
				tt = False
			else:
				d -= 1
		if tt:
			h += 1
			if h == 7:
				h = 0
			j += 1
	sd.append(j)
sd.sort()
if len(sd) == 0:
	print(s)
else:
	print(s + sd[-1])


def daysfu(a, b, c):
	li = []
	qwe = [a - 1, a - 2, b - 1, c - 1, a - 3, c - 2, b - 2]
	li.append(qwe.index(-1))
	qwe = [a - 1, b - 1, c - 1, a - 2, c - 2, b - 2, a - 3]
	li.append(qwe.index(-1))
	qwe = [b - 1, c - 1, a - 1, c - 2, b - 2, a - 2, a - 3]
	li.append(qwe.index(-1))
	qwe = [c - 1, a - 1, c - 2, b - 1, a - 2, a - 3, b - 2]
	li.append(qwe.index(-1))
	qwe = [a - 1, c - 1, b - 1, a - 2, a - 3, b - 2, c - 2]
	li.append(qwe.index(-1))
	qwe = [c - 1, b - 1, a - 1, a - 2, b - 2, c - 2, a - 3]
	li.append(qwe.index(-1))
	qwe = [b - 1, a - 1, a - 2, b - 2, c - 1, a - 3, c - 2]
	li.append(qwe.index(-1))
	return max(li)
(a, b, c) = list(map(int, input().strip().split()))
days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
fin = 0
pen = []
while a >= 3 and b >= 2 and (c >= 2):
	a -= 3
	b -= 2
	c -= 2
	fin += 7
print(fin + daysfu(a, b, c))


p = 'abcacba'
(a, b, c) = map(int, input().split())
g = {'a': a, 'b': b, 'c': c}
h = 0
for i in range(7):
	d = p[i:]
	k = g.copy()
	n = False
	o = 0
	for j in d:
		if k[j] > 0:
			k[j] -= 1
			o += 1
		else:
			n = True
			break
	if n:
		h = max(o, h)
	else:
		t = min(k['a'] // 3, k['b'] // 2, k['c'] // 2)
		o += 7 * t
		(k['a'], k['b'], k['c']) = (k['a'] - 3 * t, k['b'] - 2 * t, k['c'] - 2 * t)
		for j in p:
			if k[j] > 0:
				k[j] -= 1
				o += 1
			else:
				h = max(o, h)
				break
print(h)


import sys
input = sys.stdin.buffer.readline

def solution():
	(a, b, c) = map(int, input().split())
	f = min(a // 3, b // 2)
	f = min(f, c // 2)
	a -= 3 * f
	b -= 2 * f
	c -= 2 * f
	m = 0
	for i in range(7):
		cnt = 0
		s = [a, a, b, c, a, c, b]
		for j in range(7):
			if s[(i + j) % 7] <= 0:
				break
			cnt += 1
			if (i + j) % 7 == 0 or (i + j) % 7 == 1 or (i + j) % 7 == 4:
				s[0] -= 1
				s[1] -= 1
				s[4] -= 1
			elif (i + j) % 7 == 2 or (i + j) % 7 == 6:
				s[2] -= 1
				s[6] -= 1
			else:
				s[3] -= 1
				s[5] -= 1
		m = max(m, cnt)
	print(7 * f + m)
solution()


import copy
(F, R, C) = tuple([int(i) for i in input().split()])
whole = min(C // 2, F // 3, R // 2)
F -= whole * 3
R -= whole * 2
C -= whole * 2
cute = [0, 1, 2, 0, 2, 1, 0]
dic = [F, R, C]
extras = []
for i in range(7):
	temp = copy.copy(dic)
	for j in range(7):
		if temp[cute[(i + j) % 7]] > 0:
			temp[cute[(i + j) % 7]] -= 1
		else:
			extras.append(j)
			break
print(7 * whole + max(extras))


l = list(map(int, input().split()))
week = [0, 1, 2, 0, 2, 1, 0]
whole = min(l[0] // 3, l[1] // 2, l[2] // 2)
l[0] -= 3 * whole
l[1] -= 2 * whole
l[2] -= 2 * whole
maxm = 0
for i in range(7):
	x = int(i)
	ite = week[x]
	days = 0
	ls = list(l)
	while True:
		if ls[ite] == 0:
			break
		ls[ite] -= 1
		x += 1
		x %= 7
		ite = week[x]
		days += 1
	maxm = max(maxm, days)
print(maxm + 7 * whole)


from sys import stdin

def ria(sep=''):
	if sep == '':
		return list(map(int, input().split()))
	else:
		return list(map(int, input().split(sep)))

def rsa(sep=''):
	if sep == '':
		return input().split()
	else:
		return input().split(sep)

def ri():
	return int(input())

def rd():
	return float(input())

def rs():
	return input()
A = ria()
D = [0, 1, 2, 0, 2, 1, 0]
cA = A[0] // 3
cB = A[1] // 2
cC = A[2] // 2
cMin = min([cA, cB, cC])
A[0] -= cMin * 3
A[1] -= cMin * 2
A[2] -= cMin * 2
ma = 0
for i in range(7):
	rest = [A[0], A[1], A[2]]
	cnt = 0
	now = i
	while True:
		if rest[D[now]] == 0:
			break
		rest[D[now]] -= 1
		cnt += 1
		now += 1
		if now >= 7:
			now -= 7
	ma = max(ma, cnt)
print(ma + 7 * cMin)


def week(aa, bb, cc):
	p = ['a', 'b', 'c', 'a', 'c', 'b', 'a', 'a', 'b', 'c', 'a', 'c', 'b', 'a']
	now = 0
	for i in range(7):
		a = aa
		b = bb
		c = cc
		an = 0
		j = i
		while 1:
			if p[j] == 'a':
				a -= 1
			elif p[j] == 'b':
				b -= 1
			elif p[j] == 'c':
				c -= 1
			if a < 0 or b < 0 or c < 0:
				break
			an += 1
			j += 1
		now = max(now, an)
	return now
(a, b, c) = list(map(int, input().split()))
an = 0
if a + b + c <= 7:
	print(week(a, b, c))
else:
	if a >= 3 and b >= 2 and (c >= 2):
		t = min(a // 3, b // 2, c // 2)
		an += t * 7
		a -= t * 3
		b -= t * 2
		c -= t * 2
	a = min(3, a)
	b = min(2, b)
	c = min(2, c)
	an += week(a, b, c)
	print(an)


mod = 1000000007
MOD = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
it = lambda : tuple(map(int, input().split()))
ls = lambda : list(input())
(a, b, c) = f()
d = {0: 0, 1: 1, 2: 2, 3: 0, 4: 2, 5: 1, 6: 0}
num = min(a // 3, b // 2, c // 2)
a -= num * 3
b -= num * 2
c -= num * 2
l = [a, b, c]
num *= 7
mx = 0
for i in range(7):
	x = l[:]
	c = 0
	for j in range(i, i + 7):
		if x[d[j % 7]] == 0:
			break
		x[d[j % 7]] -= 1
		c += 1
	mx = max(mx, c)
print(num + max(mx, c))


(a, b, c) = (int(x) for x in input().split())
week = (3, 2, 2)

def weeks(a, b, c):
	(x, y, z) = week
	return min(a // x, b // y, c // z)
ans = weeks(a, b, c)
a -= 3 * ans
b -= 2 * ans
c -= 2 * ans
ans *= 7
days = [0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0]
maxim = 0
for i in range(7):
	flag = True
	counter = 0
	ost = [a, b, c]
	while flag:
		if ost[days[i + counter]] > 0:
			ost[days[i + counter]] -= 1
			counter += 1
		else:
			flag = 0
	maxim = max(maxim, counter)
print(maxim + ans)


def f(s, a, b, c, i):
	qtd = -1
	while a >= 0 and b >= 0 and (c >= 0):
		qtd += 1
		i += 1
		if s[i] == 'a':
			a -= 1
		elif s[i] == 'b':
			b -= 1
		else:
			c -= 1
	return qtd
(a, b, c) = [int(i) for i in input().strip().split()]
s = 'aabcacb' * 4
N = min(a // 3, b // 2, c // 2)
a = a - N * 3
b = b - N * 2
c = c - N * 2
max_days = N * 7 + max((f(s, a, b, c, i) for i in range(7)))
print(max_days)