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.

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.

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.

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

#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main(){
	long a,b,c;
	cin>>a>>b>>c;
	long ctr=0,val;
	val=min(a/3,min(b/2,c/2));
	ctr=val*7;
	a-=(val*3);
	b-=(val*2);
	c-=(val*2);
	int m=min(a,min(b,c));
	if(a==m){
		if(a==0){
			if(a==b && a==c)
				ctr+=0;
			else if(a==b|| a==c)
				ctr+=1;
			else
				ctr+=2;
		}
		else if(a==1){
			if(b==1)
				ctr+=4;
			else if(c==1)
				ctr+=3;
			else
				ctr+=5;
		}
		else
			ctr+=6;
	}
	else if(b==0){
		if(b==c){
			if(a==1)
				ctr+=1;
			else
				ctr+=2;
		}
		else if(c==1)
			ctr+=2;
		else
			ctr+=3;
	}
	else if(b==1){
		if(b==c)
			ctr+=4;
		else if(a==2)
			ctr+=5;
		else
			ctr+=6;
	}
	else if(c==0){
		if(a==1)
			ctr+=2;
		else if(b==1)
			ctr+=3;
		else
			ctr+=4;
	}
	else{
		if(a==2)
			ctr+=5;
		else
			ctr+=6;
	}
	cout<<ctr;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>
#include <iomanip>
#include <stack>
#include <queue>

#define endl '\n'
#define x first
#define y second
#define forn(i, n) for(int i = 0; i < n; ++i)
#define fora(el, a) for (auto el : a)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define YES "YES\n"
#define NO "NO\n"
#define sz size()

using namespace std;

typedef long long ll;
typedef pair<int, int> pt;
typedef pair<double, double> pd;
typedef pair<ll, ll> pl;

const int N = 3 * 100 * 1000 + 10;
const int INF = 2 * 1000 * 1000 * 1000 + 10;
const ll INF64 = ll(4e18);

ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return 1ll * a / gcd(a, b) * b;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];

	vector<int> days = { 0, 1, 2, 0, 2, 1, 0, 0, 1, 2, 0, 2, 1, 0 };

	int ans = 0;
	int aday = 1;

	vector<int> need = { 3, 2, 2 };
	int weeks = min(a[0] / need[0], min(a[1] / need[1], a[2] / need[2]));
	int sum = weeks * 7;
	a[0] -= need[0] * weeks;
	a[1] -= need[1] * weeks;
	a[2] -= need[2] * weeks;

	forn(st, 7) {
		int cur = 0;
		vector<int> ac(3, 0);
		forn(i, 3)
			ac[i] += a[i];
		forn(day, 7) {
			if (ac[days[st + day]] > 0) {
				ac[days[st + day]]--;
				cur++;
			}
			else break;
		}
		if ((sum + cur) > ans) {
			ans = sum + cur;
		}
	}

	cout << ans;
}

#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
    long long int a, b, c, x, y, z, s = 0, k = 0;
    long long int week;
    cin >> a >> b >> c;
    x = a / 3;
    y = b / 2;
    z = c / 2;
    week = min(x, min(y, z));
    x -= week;
    y -= week;
    z -= week;
    if (x > 0) {
        x = 3;
    }
    else {
        x = a % 3;
    }
    if (y > 0) {
        y = 2;
    }
    else {
        y = b % 2;
    }
    if (z > 0) {
        z = 2;
    }
    else {
        z = c % 2;
    }
    if (x == 0) k++;
    if (y == 0) k++;
    if (z == 0) k++;
    if (k == 0) {
        if (x == 1) {
            if (z == 2) {
                s = x + min(y, z) * 2 + (y + z - min(y, z) * 2);
            }
            else if (y == 2) {
                s = x + min(y, z) * 2;
            }
        }
        else {
            s = x + y + z;
        }
    }
    if (k == 1) {
        if (x == 0) {
            s = 2;
        }
        if (y == 0) {
            s = z + 1;
        }
        if (z == 0) {
            s = (y + x) / 2 * 2;
        }
    }
    if (k == 2) {
        if (y == z && y == 0) {
            if (x > 2) {
                s = 2;
            }
            else {
                s = x;
            }
        }
    }
    cout << week * 7 + s << endl;
    return 0;
}

#include<bits/stdc++.h>

#define  ll         long long
#define  llu        unsigned long long
#define  mod        1000000000+7
#define  pi         ((2.0)*acos(0.0))
#define  pb         push_back
#define  pf         push_front
#define  mp         make_pair
#define  fr0(i,n)   for(ll i=0;i<n;i++)
#define  fr1(i,n)   for(ll i=1;i<=n;i++)

using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll r,f,c;
    cin>>f>>r>>c;

    ll x = min(floor(f/3),min(floor(r/2),floor(c/2)));
    f-=(3*x);
    r-=(2*x);
    c-=(2*x);
    ll ans = 7*x;
    string s="rffrcfcrffrcfc";
    ll mx=0;
    fr0(j,7)
    {
        ll sum=0,R=0,C=0,F=0;
        for(ll i=j; s[i]!='\0' ; i++,sum++)
        {
            if(s[i]=='r') R++;
            if(s[i]=='f') F++;
            if(s[i]=='c') C++;

            if(R>r || C>c || F>f)
            {
                break;
            }
        }
        if(sum>mx) mx=sum;
    }
    cout<<mx+ans<<"\n";
return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];

	vector<int> idx({0, 1, 2, 0, 2, 1, 0});

	int full = min({a[0] / 3, a[1] / 2, a[2] / 2});
	a[0] -= full * 3;
	a[1] -= full * 2;
	a[2] -= full * 2;

	int ans = 0;
	for (int start = 0; start < 7; ++start) {
		int day = start;
		vector<int> b = a;
		int cur = 0;
		while (b[idx[day]] > 0) {
			--b[idx[day]];
			day = (day + 1) % 7;
			++cur;
		}
		ans = max(ans, full * 7 + cur);
	}

	cout << ans << endl;

	return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int a, b, c, a1, b1, c1, max = 0, min = 0;
	int a2, b2, c2;
	cin >> a >> b >> c;
	a2 = a / 3;
	b2 = b / 2;
	c2 = c / 2;
	min = b2 < c2 ? b2 : c2;
	min = a2 < min ? a2 : min;
	a = a - min * 3;
	b = b - min * 2;
	c = c - min * 2;
	for (int i = 1; i <= 7; i++)
	{
		int day = 0;
		a1 = a; b1 = b; c1 = c;
		for (int j = i; a1 >= 0 && b1 >= 0 && c1 >= 0; j++)
		{
			if (j == 1 || j == 4 || j == 7)
			{
				a1--;
				if (a1 < 0)
					break;
				day++;
			}
			if (j == 2 || j == 6)
			{
				b1--;
				if (b1 < 0)
					break;
				day++;
			}
			if (j == 3 || j == 5)
			{
				c1--;
				if (c1 < 0)
					break;
				day++;
			}
			if (j == 7)
				j -= 7;
		}
		if (day > max)
			max = day;
	}
	cout << max+min*7 << endl;
    return 0;
}

#include <iostream>
#include <vector>

using namespace std;

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	int menu[7] = {0, 1, 2, 0, 2, 1, 0};
	int full = min(a[1] / 2, a[2] / 2);
	full = min(a[0] / 3, full);
	a[0] -= full * 3;
	a[1] -= full * 2;
	a[2] -= full * 2;

	int plus = 0;
	for(int i = 0; i < 7; i++){
		int tmp = i;
		int b[3] = {a[0],a[1],a[2]};
		int por = 0;
		while (b[menu[tmp]] > 0){
			b[menu[tmp]]--;
			por++;
			tmp = (tmp + 1) % 7;
		}
		if (plus < por){
			plus = por;
		}

	}
	cout << full * 7 + plus;
  return 0;
}

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#define fup(i,a,b,c) for(int i=a;i<=b;i+=c)
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
vector<int> what = { 0, 1, 2, 0, 2, 1, 0 };
int a, b, c;

int calc(int x) {
	int t[3];
	t[0] = a;
	t[1] = b;
	t[2] = c;
	int res = 0;
	while (1) {
		if (t[what[x]] == 0) break;
		res++;
		t[what[x]]--;
		x = (x + 1) % 7;
	}
	return res;
}

int main() {
	cin.tie(NULL);
	ios::sync_with_stdio(false);

		cin >> a >> b >> c;

		int res = 0;
		while (a >= 3 && b >=2 && c >=2) {
			a -= 3;
			b -= 2;
			c -= 2;
			res += 7;
		}

		int rr = 0;
		for (int i = 0; i < 7; ++i) {
			rr = max(rr, calc(i));
		}
		cout << rr + res << endl;
		return 0;
}

#include <iostream>

using namespace std;

void countDays (int a, int b, int c, int d, long &cnt);

int main() {
	int a, b, c;
	long max = 0, t;

	cin >> a >> b >> c;

	for (int i = 0; i < 7; i++) {
		countDays (a, b, c, i, t);

		if (t > max)
			max = t;
	}

	cout << max << endl;

	return 0;
}

void countDays (int a, int b, int c, int d, long &cnt) {
	int t = min (min (a / 3, b / 2), c / 2);
	cnt = 7 * t;

	a -= 3 * t;
	b -= 2 * t;
	c -= 2 * t;

	for (int i = 0; i < 7; i++) {
		t = (d + i) % 7;

		if (t == 0 || t == 3 || t == 6) {
			if (a == 0)
				break;
			a--;
		}
		else if (t == 1 || t == 5) {
			if (b == 0)
				break;
			b--;
		}
		else {
			if (c == 0)
				break;
			c--;
		}

		cnt++;
	}
}

#include<iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
int main()
{
	//1,4,7-->a[1]
	//2,6-->a[2]
	//3,5-->a[3]
	int a[4]={0};
	int b[4]={0};
	for(int i=1;i<=3;i++)
	{
		cin>>a[i];

	}
	int maxx=0;
	while(a[1]>3&&a[2]>2&&a[3]>2)
	{
		a[1]-=3;
		a[2]-=2;
		a[3]-=2;
		maxx+=7;
	}
	int maxxx=maxx;
	for(int i=1;i<=7;i++)
	{
		int lon=maxxx;
		b[1]=a[1];
		b[2]=a[2];
		b[3]=a[3];
		for(int j=i;;j++)
		{
			if(j==1||j==4)
			{
				lon++;
				b[1]--;
			}
			else if(j==2||j==6)
			{
				lon++;
				b[2]--;
			}
			else if(j==3||j==5)
			{
				lon++;
				b[3]--;
			}
			else if(j==7)
			{
				lon++;
				b[1]--;
				j=0;
			}
			if(b[1]<0||b[2]<0||b[3]<0)
			{
				maxx=max(maxx,lon-1);
				break;
			}
		}
	}
	cout<<maxx;
 }

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<windows.h>
using namespace std;

int mn;
int ans;
int a,b,c,ta,tb,tc;
int  solve(int n){
    int temp=0;
    ta=a;tb=b;tc=c;
    while(ta>=0&&tb>=0&&tc>=0){
        if(n==1||n==4||n==7) ta--;
        if(n==2||n==6) tb--;
        if(n==3||n==5)tc--;
        if(n==7) n=1;
        else n++;
        if((ta>=0&&tb>=0&&tc>=0)){
            temp++;
        }
    }
    return temp;
}
int main(){
    scanf("%d%d%d",&a,&b,&c);
    mn=0x3f3f3f3f;
    mn=min(mn,a/3);
    mn=min(mn,b/2);
    mn=min(mn,c/2);
    ans+=mn*7;
    a-=3*mn;b-=2*mn;c-=2*mn;

int mx=0;
for(int i=1;i<=7;i++){
    mx=max(mx,solve(i));

}
   ans+=mx;
printf("%d\n",ans);

}

#include <bits/stdc++.h>

long long a, b, c, fullWeek, lastWeek, type[] = {0,0,1,2,0,2,1,0,0,1,2,0,2,1};

int32_t main() {
  scanf("%lld%lld%lld", &a, &b, &c);

  fullWeek = std::min({a/3, b/2, c/2});

  for (int i = 0; i < 7; i++) {
    long long rem[] = {a-(3*fullWeek), b-(2*fullWeek), c-(2*fullWeek)}, tmp = 0;
    for (int j = i; rem[type[j]]; j++, tmp++)
      rem[type[j]]--;
    lastWeek = std::max(tmp, lastWeek);
  }

  printf("%lld\n", fullWeek*7 + lastWeek);
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <list>
#include <map>
using namespace std;

int main()
{
	long a, b, c, ans, weeks, day = 0;
	vector<long> days, leftover(3);

	cin >> a >> b >> c;

	weeks = min(a / 3, b / 2);
	weeks = min(weeks, c / 2);

	leftover[0] = a - (weeks * 3);
	leftover[1] = b - (weeks * 2);
	leftover[2] = c - (weeks * 2);

	for (int i = 0; i < 7; i++)
	{
		int day = 0;
		vector<long> leftFoods = leftover;

		for (int j = i;; j++)
		{
			if (j > 6)
			{
				j = 0;
			}

			if (j == 2 || j == 4)
			{
				if (leftFoods[2] == 0)
				{
					break;
				}

				leftFoods[2]--;
			}

			if (j == 1 || j == 5)
			{
				if (leftFoods[1] == 0)
				{
					break;
				}

				leftFoods[1]--;
			}

			if (j == 0 || j == 3 || j == 6)
			{
				if (leftFoods[0] == 0)
				{
					break;
				}
				leftFoods[0]--;
			}
			day++;
		}
		days.push_back(day);
	}

	for (int i = 0; i < days.size(); i++)
	{
		if (days[i] > day)
			day = days[i];
	}

	cout << weeks * 7 + day;

	return 0;
}

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
#define ll long long
ll a,b,c;
ll sum;
void A()
{
    if(a>=1)//7
    {
        sum++;
        a--;
        if(b>=1)//6
        {
            sum++;
            b--;
            if(c>=1)//5
            {
                sum++;
                c--;
                if(a>=1)//4
                {
                    sum++;
                    a--;
                    if(c>=1)//3
                    {
                        sum++;
                        c--;
                        if(b>=1)//2
                        {
                            sum++;
                            b--;

                            if(a>=1)//1
                            {
                                sum++;
                                a--;
                            }
                        }
                    }
                }
            }
        }

    }
}
int main()
{

    scanf("%lld %lld %lld",&a,&b,&c);
    ll minn=-1;
    minn=min(a/3,b/2);
    minn=min(minn,c/2);
    a-=3*minn;
    b-=2*minn;
    c-=2*minn;
    ll SUM=0;
    ll s;
    s=minn*7;
    sum=0;
    ll aa,bb,cc;
    aa=a;
    bb=b;
    cc=c;
    if(a>=1)
    {
        a--;
        sum++;
        A();
    }
    SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    if(b>=1)
    {
        b--;
        sum++;
        if(a>=1)
        {
            a--;
            sum++;
            A();
        }
    }
    SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    if(c>=1)
    {
        c--;
        sum++;
        if(b>=1)
        {
            b--;
            sum++;
            if(a>=1)
            {
                a--;
                sum++;
                A();
            }
        }
    }
    SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    if(a>=1)
    {

        a--;
        sum++;
        if(c>=1)
        {
            c--;
            sum++;
            if(b>=1)
            {
                b--;
                sum++;
                if(a>=1)
                {
                    a--;
                    sum++;
                    A();
                }
            }
        }
    }
     SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    if(c>=1)
    {
        c--;
        sum++;
         if(a>=1)
        {

            a--;
            sum++;
            if(c>=1)
            {
                c--;
                sum++;
                if(b>=1)
                {
                    b--;
                    sum++;
                    if(a>=1)
                    {
                        a--;
                        sum++;
                        A();
                    }
                }
            }
        }
    }
     SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    if(b>=1)
    {
        b--;
        sum++;
        if(c>=1)
    {
        c--;
        sum++;
         if(a>=1)
        {

            a--;
            sum++;
            if(c>=1)
            {
                c--;
                sum++;
                if(b>=1)
                {
                    b--;
                    sum++;
                    if(a>=1)
                    {
                        a--;
                        sum++;
                        A();
                    }
                }
            }
        }
    }
    }
    SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    if(a>=1)
    {
        a--;
        sum++;
            if(b>=1)
    {
        b--;
        sum++;
        if(c>=1)
    {
        c--;
        sum++;
         if(a>=1)
        {

            a--;
            sum++;
            if(c>=1)
            {
                c--;
                sum++;
                if(b>=1)
                {
                    b--;
                    sum++;
                    if(a>=1)
                    {
                        a--;
                        sum++;
                        A();
                    }
                }
            }
        }
    }
    }
    }
    SUM=max(s+sum,SUM);
    sum=0;
    a=aa;b=bb;c=cc;
    printf("%lld",SUM);
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<string>
using namespace std;

int main()
{
    int a,b,c,ans,maxx=0;
    cin>>a>>b>>c;
    int t1=a/3,t2=b/2,t3=c/2,day;
    int minn=0x3f3f3f3f;
    if(minn>t1) minn=t1;
    if(minn>t2) minn=t2;
    if(minn>t3) minn=t3;
    ans+=7*minn;
    a-=3*minn;b-=2*minn;c-=2*minn;

    for(int i=1;i<=7;i++)
    {
        int ans1=0;
        int j=i;
        t1=a;t2=b;t3=c;
        while(1)
        {
            if(j==1||j==4||j==7)
            {
                if(t1-1<0) break;t1--;ans1++;
            }

            if(j==2||j==6)
            {
                if(t2-1<0) break;t2--;ans1++;
            }

            if(j==3||j==5)
            {
                if(t3-1<0) break;t3--;ans1++;
            }

            j++;
            if(j>7) j=1;

        }

        if(ans1>maxx)

            maxx=ans1;
    }

    cout<<ans+maxx;

    return 0;

}

#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int minmin(int a,int b,int c);
int f(int a,int b,int c);
int main()
{
	int a,b,c;
	int a1,b1,c1;
	cin>>a>>b>>c;
	int total=0;
	if(a>=3&&b>=2&&c>=2)
	{
		a1=a/3;
		b1=b/2;
		c1=c/2;
		int min=minmin(a1,b1,c1);
		a=a-min*3;
		b=b-min*2;
		c=c-min*2;
		total=total+7*min;
	}
		if(a>3)
		{
			a=3;
		}
		if(b>2)
		{
			b=2;
		}
		if(c>2)
		{
			c=2;
		}
	total=total+f(a,b,c);
	cout<<total<<endl;
	return 0;
}

int minmin(int a,int b,int c)
{
	int min=100;
	if(a>b)
	{
		min=b;
	}
	else
	{
		min=a;
	}
	if(min>c)
	{
		min=c;
	}
	return min;
}
int f(int a,int b,int c)
{
	if(b==0&&c==0)
	{
		if(a>=3)
		{
			a=2;
		}
		return a;
	}

	if(a==0)
	{
		if(b==2)
		{
			b=1;
		}
		if(c==2)
		{
			c=1;
		}
		return b+c;
	}
	if(b==0)
	{
		if(a!=0)
		{
			return c+1;
		}
		if(a==0)
		{
			if(c!=0)
			{
				return 1;
			}
		}
	}
	if(c==0)
	{
		if(a>=3)
		{
			a=2;
		}
		if(a==1)
		{
			if(b==0)
			{
				return 1;
			}
			else
			{
				return 2;
			}
		}
		else
		{
			if(b>=3)
			{
				b=2;
			}
			return a+b;
		}
	}
	if(a==1&&c==1)
	{
		return 3;
	}
	return a+b+c;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
int s[7]= {1,2,3,1,3,2,1};
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int maxn=min(min(a/3,b/2),c/2);
    int ans;
    ans=maxn*7;
    int A=0;
    a-=3*maxn;
    b-=2*maxn;
    c-=2*maxn;
    for(int i=0; i<7; i++)
    {
        int a1=a;
        int b1=b;
        int c1=c;
        int flog=0;
        for(int j=0; j<7; j++)
        {
            if(s[(i+j)%7]==1)
            {
                if(a1==0)
                    flog=1;
                a1--;
            }
            else if(s[(i+j)%7]==2)
            {
                if(b1==0)
                    flog=1;
                b1--;
            }
            else
            {
                if(c1==0)
                    flog=1;
                c1--;
            }
            if(flog==1)
            {
                A=max(A,j);
                break;
            }
        }
    }
    ans=ans+A;
    printf("%d\n",ans);
    return 0;
}

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int xf, xr, xc;
	cin >> xf >> xr >> xc;
	int min = 1000000000;
	if (xf/3 < min)min = xf/3;
	if (xr/2 < min)min = xr/2;
	if (xc/2 < min)min = xc/2;
	int D = min*7;
	xf -= min * 3;
	xr -= min * 2;
	xc -= min * 2;
	min = 1000000000;
	int W[] = { 2, 1, 1, 2, 3, 1, 3 };
	int max = 0;
	for (int k = 0; k < 7; k++){
		int xf1 = xf, xr1 = xr, xc1 = xc;
		int d = 0;
		int i;
		bool ch = 1;
		for (i=k; i < 7; i++){
			if (xf1 == 0 && W[i] == 1){ ch = 0; break; }
			if (xr1 == 0 && W[i] == 2){ ch = 0; break; }
			if (xc1 == 0 && W[i] == 3){ ch = 0; break; }

			if (W[i] == 1)xf1--;
			if (W[i] == 2)xr1--;
			if (W[i] == 3)xc1--;
			d++;

		}
		if (ch){
			for (i = 0; i < k; i++){
				if (xf1 == 0 && W[i] == 1)break;
				if (xr1 == 0 && W[i] == 2)break;
				if (xc1 == 0 && W[i] == 3)break;

				if (W[i] == 1)xf1--;
				if (W[i] == 2)xr1--;
				if (W[i] == 3)xc1--;
				d++;
			}
		}
		if (max < d)max = d;
	}
	cout << D + max << endl;
	return 0;
}

#include <bits/stdc++.h>
#define endl '\n'
#define PB push_back
#define PF push_front
#define MP make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
//#define int long long
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<pii> vpii;
typedef unsigned int ui;

const int INF = 1e9+7;
const ll LINF = 1e18+12;
const int MAXN = 1e5;
const ll PRIME = 3e9+19;

vector <int> mt(10000, -1);
vector <vi> g;
vector <int> used(10000, 0);

signed main(){
    ios_base::sync_with_stdio(false); //cin.tie(nullptr); cout.tie(nullptr);

    vi a(3);
    cin >> a[0] >> a[1] >> a[2];
    int full = min(min(a[0] / 3, a[1] / 2), a[2] / 2);
    a[0] -= full * 3;
    a[1] -= full * 2;
    a[2] -= full * 2;

    int ans = 0;
    int d[7] = {0, 1, 2, 0, 2, 1, 0};
    for (int i = 0; i < 7; i++){
        int cur = i;
        vi p = a;

        int k = 0;
        while (p[d[cur]] > 0){
            p[d[cur]]--;
            k++;
            cur = (cur + 1) % 7;
        }
        ans = max(ans, full * 7 + k);
    }
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	while(~scanf("%d%d%d",&a,&b,&c)){
		int minn=min(a/3,min(b/2,c/2));
		a=a-3*minn;b=b-2*minn;c=c-2*minn;
		int ans=minn*7,last=min(a,min(b,c));
		if(a==0){
			if(b==0){
				if(c==0) ans=ans;
				else ans+=1;
			}
			else{
				if(c==0) ans+=1;
				else ans+=2;
			}
		}
		else if(a==1){
			if(b==0){
				if(c==0) ans+=1;
				else if(c==1) ans+=2;
				else ans+=3;
			}
			else if(b==1){
				if(c==0) ans+=2;
				else if(c==1) ans+=3;
				else ans+=4;
			}
			else{
				if(c==0) ans+=2;
				else if(c==1) ans+=3;
				else ans+=5;
			}
		}
		else if(a==2){
			if(b==0){
				if(c==0||c==1) ans+=2;
				else ans+=3;
			}
			else if(b==1){
				if(c==0) ans+=3;
				else if(c==1) ans+=4;
				else ans+=5;
			}
			else{
				if(c==0) ans+=4;
				else if(c==1) ans+=5;
				else ans+=6;
			}
		}
		else{
			if(b==0){
				if(c==0||c==1) ans+=2;
				else ans+=3;
			}
			else if(b==1){
				if(c==0) ans+=3;
				else if(c==1) ans+=5;
				else ans+=6;
			}
			else{
				if(c==0) ans+=4;
				else if(c==1) ans+=6;
				else ans+=7;
			}
		}printf("%d\n",ans);
	}
}

#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <cmath>
#include <bitset>

#define haboh_top ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long
using namespace std;
const int INF = 1e9;

int days[] = { 0, 1, 2, 0, 2, 1, 0 };
int per_week[] = { 3, 2, 2 };

signed main() {
	haboh_top;
	vector <int> a(3);
	cin >> a[0] >> a[1] >> a[2];
	int ans = 0;
	for (int i = 0; i < 7; i++) {
		vector <int> b = a;
		int day = 0;
		for (int j = i; j < 7; j++) {
			b[days[j]]--;
			if (b[0] < 0 || b[1] < 0 || b[2] < 0) {
				break;
			}
			day++;

		}
		int weeks = min({ b[0] / per_week[0], b[1] / per_week[1], b[2] / per_week[2] });
		day += weeks * 7;
		for (int j = 0; j < 3; j++) {
			b[j] -= per_week[j] * weeks;
		}
		for (int j = 0; j < 7; j++) {
			b[days[j]]--;
			if (b[days[j]] < 0) {
				break;
			}
			day++;
		}
		ans = max(ans, day);
	}
	cout << ans;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int prim[1000009], x=1000008;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    long long a,b,c, d, sum=0;
    cin>>a>>b>>c;
    d = min(a,min(b,c));
    if(d==a){
        sum+= (a/3)*7;

        if(a%3>0)
         sum+= (a%3)+2;
        b -= (a/3)*2;
        c -= (a/3)*2;
        if(a%3>0){
            b--; c--;
        }

        if(a>1)
        sum+=min((long long)1, b)+ min((long long)1,c);
        else if(a==1 && c>=1 && b>=1){
            sum+=min((long long)1, b)+ min((long long)1,c);
        }
        else if (c==1)sum++;
    }
    else{
        d = min((a/3),min((b/2),(c/2)));
        sum+= d*7;
        a-=d*3; c-=d*2; b-=d*2;
        if(c==0) {
                if(a==1) sum+= 2;
        else
            sum += min((long long)2,a) + min((long long)2,b);
        }
        else if(b==0) sum += max(min((long long)2,a) , min((long long)2,c)+1);
        else if(c==1) sum += min((long long)3,a) + min((long long)2,b) + c;
        else if(b==1) sum += min((long long)3,a) + b + min(c,(long long)2);
        else if(a==0) sum+=2;
        else if(a>0){
            if(a%3>0)
         sum+= (a%3)+2;
        b -= (a/3)*2;
        c -= (a/3)*2;
        if(a%3>0){
            b--; c--;
        }

        if(a>1)
        sum+=min((long long)1, b)+ min((long long)1,c);
        else if(a==1 && c>1 && b>1){
            sum+=min((long long)1, b)+ min((long long)1,c);
        }
        if (c==1)sum++;
        }
    }
    cout<<sum;
    return 0;
}

//Ñïóëà¸ ìóëà¸
//Íèããà âàé ÷èáèêè÷è ìóðà¸
//Øèðûëè ãó äå çå ìóíëà¸
//Àëå ôàñî íèããà ñî áàìàå

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

#define int long long

using namespace std;

int g[] = {0, 1, 2, 3, 1, 3, 2, 1};
main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a,b,c;
	cin >> a >> b >> c;
	int m = min(a/3, min(b/2, c/2));
	a -= (m * 3);
	b -= (m * 2);
	c -= (m * 2);
	int A = a, B = b, C = c, ans = 0;
	for(int i = 1; i <= 7; ++i){
		a = A, b = B, c = C;
		int p = i, cnt = 0;
		while(true)
		{
			if(p == 8)
				p = 1;
			if(g[p] == 1)
			{
				--a;
				if(a < 0)
					break;
			}
			else if(g[p] == 2)
			{
				--b;
				if(b < 0)
					break;
			}
			else
			{
				--c;
				if(c < 0)
					break;
			}
			++cnt;
			++p;
		}
		ans = max(ans, cnt);
	}
	cout << m * 7 + ans;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    vector<int> s({0, 1, 2, 0, 2, 1, 0});
    int full = min({v[0] / 3, v[1] / 2, v[2] / 2});
    v[0] -= full*3;
    v[1] -= full*2;
    v[2] -= full*2;
	int ans = 0;
	//Para decidir qual dia é mais interessante de se começar a viagem de beto.
	for (int start = 0; start < 7; ++start) {
		int day = start;
		//Crio um novo vetor b pq se eu usar o v não vai dar para testar com o proximo caso para descobrir o melhor dia.
		vector<int> b = v;
		int cur = 0;
		while (b[s[day]] > 0) {
			--b[s[day]];
			day = (day + 1) % 7;
			++cur;
		}
		ans = max(ans, full * 7 + cur);
	}

	cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
#define JN ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define mod 1000000007

#define pb push_back
#define mp make_pair

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;

int main ()
{
	JN;

	int a, b, c;

	cin >> a >> b >> c;

	ll days=0;

	ll ca = a/3;
	ll cb= b/2;
	ll cc = c/2;

	ll hell = min({ca, cb, cc})*7;
	days = days + min({ca, cb, cc}) * 7;
	a = a- min({ca, cb, cc})*3;
	b = b - min({ca, cb, cc})*2;
	c = c -  min({ca, cb, cc})*2;

	//cout << a << " " << b << " " << c << endl;

	for(int i=0; i<7; i++)
	{
		ll dd[7]={0,1, 2, 0, 2, 1, 0};
		ll tmp[3] = {a,b,c};
		int more=0;

		for(int j=0; j<7; j++)
		{
			if(tmp[dd[(i+j)%7]] == 0)
				break;
			tmp[dd[(i+j)%7]]--;
			more++;

		}
		//if(i==6)
			//cout << i << " " << more << endl;
		days = max(days, hell+more);
	}

	cout << days << endl;

	return 0;
}

#include <iostream>

using namespace std;

enum week {mon, tues, wednes, thurs, fri, satur, sun};
int week[10];
int main() {
    week[mon] = week[thurs] = week[sun] = 1;
    week[tues] = week[satur] = 2;
    week[wednes] = week[fri] = 3;
    int a, a0, b, b0, c, c0;
    cin >> a0 >> b0 >> c0;

    int days_before = 0;
    while (a0 > 10 && b0 > 10 && c0 > 10) {
        a0 -= 3; b0 -= 2; c0 -= 2;
        days_before += 7;
    }

    int day, cnt, max_cnt = INT_MIN;
    for (int i = mon; i <= sun; ++i) {
        a = a0, b = b0, c = c0, day = i, cnt = -1;
        while (a != -1 && b != -1 && c != -1) {
            if (week[day] == 1) --a;
            else if (week[day] == 2) --b;
            else --c;
            ++cnt;
            if (day == sun) day = mon;
            else ++day;

        }
        max_cnt = max(cnt, max_cnt);
    }
    cout << days_before + max_cnt << endl;

    return 0;
}

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int main()
{
    long long a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    long long d=0;
    long long n=min(a/3,min(b/2,c/2));

    d=n*7;

    a-=n*3;
    b-=n*2;
    c-=n*2;

    int m[10]={1,2,3,1,3,2,1};

    long long max=0;

    for(int qwe=0;qwe<7;qwe++)
    {

        for(int i=0;i<7;i++)
        {
            for(int j=i;j<7;j++)
            {
                long long ap=a, bp=b, cp=c;
                long long p=0;

                for(int l=i;l<=j;l++)
                {
                    if(m[l]==1)
                    {
                        ap--;
                        if(ap<0)
                        {
                            if(p>max)
                                max=p;
                            break;
                        }

                    }

                    if(m[l]==2)
                    {
                        bp--;
                        if(bp<0)
                        {
                            if(p>max)
                                max=p;
                            break;
                        }
                    }

                    if(m[l]==3)
                    {
                        cp--;
                        if(cp<0)
                        {
                            if(p>max)
                                max=p;
                            break;
                        }
                    }

                    p++;
                }
            }
        }

        int s=m[0];

        for(int i=0;i<6;i++)
            m[i]=m[i+1];

        m[6]=s;

    }

    printf("%lld",d+max);
	return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int a , b , c;
	int minn = 2e9;
	int ans = 0;
	scanf("%d %d %d" , &a , &b , &c);
	minn = min(minn , a/3);
	minn = min(minn , b/2);
	minn = min(minn , c/2);
	ans += minn*7;
//	printf("ans = %d\n" , ans);
	a -= minn*3;
	b -= minn *2;
	c -= minn*2;
	int op = -1 , pp=0;
	for(int j = 1 ; j <= 7 ; j++)
	{
		pp = 0;
		int a1 = a , b1 = b , c1 = c;
		for(int i = j ; i <= 7+j ; i++)
		{
			if(i%7 == 1 || i%7 == 4 || i%7 == 0)
			{
				if(a1 == 0)
				{
					break;
				}
				a1 -= 1;
				pp += 1;

			}
			else if(i%7 == 2 || i%7 == 6)
			{
				if(b1 == 0)
				{
					break;
				}
				b1 -= 1;
				pp += 1;

			}
			else if(i%7 == 3 || i%7 == 5)
			{
				if(c1 == 0)
				{
					break;
				}
				c1 -= 1;
				pp += 1;

			}
		}
		op = max(op , pp);
	}
	printf("%d\n" , ans+op);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define il inline
#define rg register
#define ll long long
#define CL(a,b) memset(a,b,sizeof a)
int main()
{
    ll a,b,c;
    cin>>a>>b>>c;
    ll a1,b1,c1;
    ll cnt=0,ans=0;
    ll tt=0;
    for(int i=1;i<=7;i++)
    {
        tt=0;
        cnt=0;
        a1=a,b1=b,c1=c;
        int t=i;
        while(1)
        {

            if(t==1||t==4||t==7)
            {
                if(a1) a1--;
                else break;
            }
            else if(t==2||t==6)
            {
                if(b1) b1--;
                else break;
            }
            else
            {
                if(c1) c1--;
                else break;
            }
            t++;
            cnt++;
            if(a1>=3&&b1>=2&&c1>=2)
            {
                tt=min(min(a1/3,b1/2),c1/2);
                a1-=tt*3;
                b1-=tt*2;
                c1-=tt*2;
                cnt+=tt*7;
            }
            if(t>7) t-=7;
        }
        ans=max(ans,cnt);
    }
    cout<<ans;
    return 0;
}

#include <iostream>

using namespace std;

void countDays (int a, int b, int c, int d, long &cnt);

int main() {
	int a, b, c;
	long max = 0, t;

	cin >> a >> b >> c;

	for (int i = 0; i < 7; i++) {
		countDays (a, b, c, i, t);

		if (t > max)
			max = t;
	}

	cout << max << endl;

	return 0;
}

void countDays (int a, int b, int c, int d, long &cnt) {
	int t = min (min (a / 3, b / 2), c / 2);
	cnt = 7 * t;

	a -= 3 * t;
	b -= 2 * t;
	c -= 2 * t;

	for (int i = 0; i < 7; i++) {
		t = (d + i) % 7;

		if (t == 0 || t == 3 || t == 6) {
			if (a == 0)
				break;
			a--;
		}
		else if (t == 1 || t == 5) {
			if (b == 0)
				break;
			b--;
		}
		else {
			if (c == 0)
				break;
			c--;
		}

		cnt++;
	}
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	long long wa = (a - 3) / 3, wb = (b - 2) / 2, wc = (c - 2) / 2;
	long long week = min(wa, min(wb, wc));
	a -= week * 3; b -= week * 2; c -= week * 2;
	long long aa = a, bb = b, cc = c;
	long long ans = week * 7;
	for (int i = 0; i < 7; i++)
	{
		long long sum = 0;
		a = aa; b = bb;  c = cc;
		for (int j = 0; j < 21; j++)
		{
			if ((i + j) % 7 == 0 || (i + j) % 7 == 3 || (i + j) % 7 == 6)a--;
			else if ((i + j) % 7 == 1 || (i + j) % 7 == 5)b--;
			else if ((i + j) % 7 == 2 || (i + j) % 7 == 4)c--;
			if (a < 0 || b < 0 || c < 0)break;
			else sum++;
		}
		ans = max(ans, week * 7 + sum);
	}
	cout << ans;
	return 0;
}

// รђгเ ﻮคภєรђคץ ภค๓คђ //  ןคเ ๒คןคгคภﻮ ๒คlเ // jለi ወለէለ ծi //
#include<bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define mod                   1000000007
#define ll                    long long
#define Author                std::ios_base::sync_with_stdio(0);
#define ABHISHEK_SHARMA       cout.tie(0);
#define IIIT_ALLAHABAD        cin.tie(0);
#define all(v)                v.begin(),v.end()
#define pb(a)                 push_back(a)
#define lb(v,t)               lower_bound(all(v),t)-v.begin()
#define ub(v,t)               upper_bound(all(v),t)-v.begin()

void solve(){
    ll n, i, j, k, a, b, c;
    char req[7]={'f','r','c','f','c','r','f'};
    cin>>a>>b>>c;
    ll ans=INT_MIN;
    ll wk=min(a/3,min(b/2,c/2));
    a=a-wk*3;b=b-wk*2;c=c-wk*2;
    ll day=wk*7;
    for(i=0; i<7; i++){
        ll count=0;
        ll tema=a, temb=b, temc=c;
        for(j=i; j<=(6+i); j++){
            k=j%7;
            if(tema==0 && req[k]=='f'){
                break;
            }
            if(req[k]=='f'){
                tema--;
                count++;
            }
            if(temb==0 && req[k]=='r'){
                break;
            }
            if(req[k]=='r'){
                temb--;
                count++;
            }
            if(temc==0 && req[k]=='c'){
                break;
            }
            if(req[k]=='c'){
                temc--;
                count++;
            }
        }
        ans=max(ans,day+count);
    }
    cout<<ans;
}

int main(){
    //Booster
    Author
        ABHISHEK_SHARMA
        IIIT_ALLAHABAD
    //Driver Code here
    ll t=1, i;
    //cin>>t;
    for(i=1; i<=t; i++){
        solve();
    }
    return 0;
}

#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	setlocale(LC_ALL, "Russian");
	vector<int> a(3);
	int ans = 0;
	cin >> a[0] >> a[1] >> a[2];
	int max = 0;
	vector<int> foodType({ 0, 1, 2, 0, 2, 1, 0 });

	int full = min({ a[0] / 3, a[1] / 2, a[2] / 2 });
	a[0] -= full * 3;
	a[1] -= full * 2;
	a[2] -= full * 2;

	for (int start = 0; start < 7; ++start) {
		int day = start;
		vector<int> newArr = a;
		int cur = 0;
		while (newArr[foodType[day]] > 0) {
			--newArr[foodType[day]];
			day = (day + 1) % 7;
			++cur;
		}
		if ( cur> max) {
			max = cur;
		}
		ans = full * 7 + max;

	}

	cout << ans << endl;

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define mk make_pair

void PLAY()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

/*ll vis[1000000];
ll len[1000000];
ll cnt=0;
vector<vector<ll>>x;

ll dfs(ll n)
{
    //cout<<n<<" a"<<endl;
    vis[n] = 1;
    for(int i=0;i<x[n].size();i++)
    {
        ll lol = x[n][i];
        if(!vis[lol])
        {
            dfs(lol);
            cnt++;
        }
    }

    return cnt;
}

void seth(ll a, ll b)
{
    if(vis[a]==2)
        return ;
    vis[a] = 2;
    len[a] = b;
    for(int i=0;i<x[a].size();i++)
    {
        ll lol = x[a][i];
        if(vis[lol]!=2)
        {
            seth(lol, b);
        }
    }
}*/

const int MOD = 1e9 + 7;
ll poww(ll b, ll p)
{
    if (p == 0)
        return 1;

    ll sq = poww(b, p / 2);

    sq = (sq * sq) % MOD;

    if (p % 2 == 1)
    {
        sq = (sq * b) % MOD;
    }

    return sq;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll a, b, c;
    cin >> a >> b >> c;
    ll ra = a / 3;
    ll rb = b / 2;
    ll rc = c / 2;
    ll mini = min(ra, min(rb, rc));
    ll ans = 0;
    a -= (mini * 3);
    b -= (mini * 2);
    c -= (mini * 2);
    ans += (mini * 7);

    //cout<<a<<" "<<b<<" "<<c<<endl;
    if(a==1 && c==1)
    {
        ans+=(1 + min(b, 1 * 1ll) + 1);
    }
    else if (a == 0)
    {
        ans += (min(b, 1 * 1ll) + min(c, 1 * 1ll));
    }
    else if (b == 0)
    {
        ans += max(2*1ll,(min(a, 1 * 1ll) + min(c, 2 * 1ll)));
    }
    else if (c == 0)
    {
        if(a>=2)
            ans += (min(a, 2 * 1ll) + min(b, 2 * 1ll));
        else
            ans += (min(a, 2 * 1ll) + min(b, 1 * 1ll));
    }
    else
    {
        ans += (min(a, 3 * 1ll) + min(b, 2 * 1ll) + min(c, 2 * 1ll));
    }

    cout << ans << endl;

    return 0;
}

#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	long long a, b, c, max_a, max_b, max_c, ans = 0, ca = 0;
	cin >> a >> b >> c;
	max_a = a / 3;
	max_b = b / 2;
	max_c = c / 2;
	ans = min(max_a, min(max_b, max_c));
	a -= ans * 3; // Sunday Monday Thursday
	b -= ans * 2; // Tuesday Saturday
	c -= ans * 2; // Wednesday Friday
	ans *= 7; // Saturday Sunday Monday Tuesday Wednesday Thursday Friday 2 1 1 2 3 1 3
	for (int q = 0; q < 8; q++) {
		long long ha = 0, a1, b1, c1;
		a1 = a;
		b1 = b;
		c1 = c;
		for (int i = q; i < 8; i++) {
			if ((i % 7) == 0) if (b1 <= 0) { break; }
			else b1--, ha++;
			if ((i % 7) == 1) if (a1 <= 0) { break; }
			else a1--, ha++;
			if ((i % 7) == 2) if (a1 <= 0) { break; }
			else a1--, ha++;
			if ((i % 7) == 3) if (b1 <= 0) { break; }
			else b1--, ha++;
			if ((i % 7) == 4) if (c1 <= 0) { break; }
			else c1--, ha++;
			if ((i % 7) == 5) if (a1 <= 0) { break; }
			else a1--, ha++;
			if ((i % 7) == 6) if (c1 <= 0) { break; }
			else c1--, ha++;
		}
		ca = max(ha, ca);
	}
	cout << ans + ca << endl; cin >> ca;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <regex>
#include <unordered_set>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>
#include <time.h>
#include <numeric>
#include <complex>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define fill(x, y) memset(x, y, sizeof(x))
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define itn int
#define re return
#define prev PREV
#define next NEXT

#define sz(x) ((int)x.size())

const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int maxn = 2*1000005;

#define FILENAME ""

ll temp3;

ll f (ll temp, ll a, ll b, ll c) {
    ll s = 0;
    for (int i = temp; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re (temp3 - 2)*7 + s;
        }
        ++s;
    }
    for (int i = 0; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re (temp3 - 2)*7 + s;
        }
        ++s;
    }
    for (int i = 0; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re (temp3 - 2)*7 + s;
        }
        ++s;
    }
    for (int i = 0; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re (temp3 - 2)*7 + s;
        }
        ++s;
    }
}

ll f1 (ll temp, ll a, ll b, ll c) {
    ll s = 0;
    for (int i = temp; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re s;
        }
        ++s;
    }
    for (int i = 0; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re s;
        }
        ++s;
    }
    for (int i = 0; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re s;
        }
        ++s;
    }
    for (int i = 0; i < 7; i++) {
        if (i == 0 || i == 3 || i == 6) {
            --a;
        }
        if (i == 1 || i == 5) {
            --b;
        }
        if (i == 2 || i == 4) {
            --c;
        }
        if (a < 0 || b <0 || c < 0) {
            re s;
        }
        ++s;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b, c;
    cin >> a >> b >> c;
    ll temp = a/3, temp1 = b/2, temp2 = c/2;
    temp3 = min(min(temp, temp1), temp2);
    if (temp3 >= 2) {
        a -= (temp3 - 2)*3;
        b -= (temp3 - 2)*2;
        c -= (temp3 - 2)*2;
        ll maxi = 0;
        for (int i = 0;i < 7; i++) {
            maxi = max(maxi, f(i, a, b, c));
        }
        cout << maxi;
        re 0;
    }
    else {
        ll maxi = 0;
        for (int i = 0; i < 7; i++) {
            maxi = max(maxi, f1(i, a, b, c));
        }
        cout << maxi;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=double;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vpll=vector<pll>;
using vvll=vector<vll>;
#define FOR(i,a,b) for(ll i=a;i<(ll)b;++i)
#define ROF(i,a,b) for(ll i=a;i>=(ll)b;--i)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define aa first
#define bb second
#define PB push_back
#define EQ(a,b) (fabs(a-b)<=(fabs(a+b)*EPS))
#define mp make_pair

int A,B,C;

int calc(int a,int b,int c,int s){
  int res=0;
  if(s){
    FOR(day,s,7){
      if(day==0||day==3||day==6){
        if(a<=0)return res;
        --a;
      }
      else if(day==1||day==5){
        if(b<=0)return res;
        --b;
      }
      else{
        if(c<=0)return res;
        --c;
      }
      ++res;
    }
  }
  const int weeks=min(min(a/3,b/2),c/2);
  a-=3*weeks;
  b-=2*weeks;
  c-=2*weeks;
  res+=7*weeks;
  assert(a<=3||b<=2||c<=2);
  FOR(day,0,7){
    if(day==0||day==3||day==6){
      if(a<=0)break;
      --a;
    }
    else if(day==1||day==5){
      if(b<=0)break;
      --b;
    }
    else{
      if(c<=0)break;
      --c;
    }
    ++res;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(0);cout.tie(0);cin.tie(0);
  cin>>A>>B>>C;
  int res=0;
  F(7)res=max(res,calc(A,B,C,i));
  cout<<res<<endl;

  return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <string>
#include <map>

using namespace std;

int main()
{
	int ryb, krol, kur, cnt = 0;
	cin >> ryb >> krol >> kur;
	int ned = min(min(krol, kur) / 2, ryb / 3);
	cnt += ned * 7;
	ryb -= ned * 3;
	krol -= ned * 2;
	kur -= ned * 2;

	char mas[7] = { 'r','k','o','r', 'o','k','r' };
	int max = 0;

	for (int j = 0; j < 7; j++) {
		int i = j, cnt1 = 0, ryb1 = ryb, krol1 = krol, kur1 = kur;
			while (1) {
				if (mas[i] == 'r') {
					if (ryb1 != 0) {
						ryb1--; cnt1++; i++;
					}
					else break;
				}
				if (mas[i] == 'k') {
					if (krol1 != 0) {
						krol1--; cnt1++; i++;
					}
					else break;
				}
				if ((mas[i]) == 'o') {
					if (kur1 != 0) {
						kur1--; cnt1++; i++;
					}
					else break;
				}
				if (i == 7) i = 0;
			}
			if (cnt1 > max) max = cnt1;
	}

	/*for (int i = 0; i < 7; i++) {
		if (mas[i] == 'r') {
			if (ryb != 0) {
				ryb--; cnt++;
			}
			else break;
		}
		if (mas[i] == 'k') {
			if (krol != 0) {
				krol--; cnt++;
			}
			else break;
		}
		if ((mas[i]) == 'o') {
			if (kur != 0) {
				kur--; cnt++;
			}
			else break;
		}
	}*/

	cout << cnt+max;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
int f,r,c,d,fc,rc,cc;

int& getch(int x) {
    if (x==1) return fc;
    if (x==2) return rc;
    if (x==3) return cc;
}

int main()
{
    cin >> f >> r >> c;
    d = min(min(f/3, r/2), min (r/2, c/2));
    f -= 3*d;
    r -= 2*d;
    c -= 2*d;
    d*=7;

    int dayT = 0;
    int dow[] = {1, 2, 3, 1, 3, 2, 1};
	for (int st=0;st<7;st++) {
		fc = f; rc = r; cc = c;
		int day = st;
		int days = 0;
		while (getch(dow[day])>0) {
			getch(dow[day])--;
			day = (day+1)%7;
			days++;
		}
		dayT = max(dayT, days);
	}
    cout << d+dayT;
    return 0;
}

// FRCFCRF

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	int a, b, c;
	cin >> a >> b >> c;

	int week = min({ a / 3, b / 2, c / 2 });

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

	int arr[] = { 0, 1, 2, 0, 2, 1, 0};
	vector<int> rem({ a, b, c });

	int max_d = -1;

	// monday
	for (int start = 0; start < 7; start++)
	{
		int cur = 0;
		vector<int> temp = rem;
		int day = start;

		while (temp[arr[day]] > 0)
		{
			temp[arr[day]] -= 1;
			cur += 1;
			day = (day + 1) % 7;
		}

		max_d = max(max_d, cur);
	}

	cout << 7 * week + max_d << endl;
}

#include <iostream>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ll long long
using namespace std;
int x,y,z,d,a[5];
int main()
{
    cin>>x>>y>>z;
    d=0;
    if(x>=3&&y>=2&&z>=2)
    {
        d=min(min(x/3,y/2),z/2);
        x=x-3*d;
        y=y-2*d;
        z=z-2*d;
    }
    a[0]=x;a[1]=y;a[2]=z;
    d=d*7;
    int ans=0;
    int dis[15]={0,1,2,0,2,1,0,0,1,2,0,2,1,0};
    for(int i=0;i<14;i++)
    {
        int t=0,b[3];
        b[0]=0;b[1]=0;b[2]=0;
        while(a[dis[t+i]]>b[dis[t+i]])
        {
            b[dis[t+i]]++;
            t++;
        }
        ans=max(ans,t);
    }
    cout<<ans+d<<endl;
	return 0;
}

#include <bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 1e3 + 7;
const long long inf = 6e9 + 7;
const long long mod = 1e9 + 7;

int res;
int a[4];
int main()
{
    /// freopen( "input.txt", "r", stdin );
    /// freopen( "output.txt", "w", stdout );

    ios_base::sync_with_stdio( false );

    cin >> a[1] >> a[2] >> a[3];
    vector<int> d = {0, 1, 2, 0, 2, 1, 0};
    int k = min({a[1] / 3, a[2] / 2, a[3] / 2});
    a[1] -= k * 3, a[2] -= k * 2, a[3] -= k * 2;
    for ( int i = 0; i < 7; i ++ ){
        int ans = 0;
        int now = i;
        vector<int> b = {a[1], a[2], a[3]};
        while( b[d[now]] > 0 ){
            ans ++;
            b[d[now]] --;
            now = (now + 1) % 7;
        }
        res = max(res, 7 * k + ans);
    }cout << res << "\n";
}

#include <iostream>
#include <vector>
using namespace std;
vector<long long> a ,v ;
long long ind[7] = {0, 0, 1, 2, 0, 2, 1} , ans , wmn ;
bool f;
int main()
{
	a.resize(3);
	cin >> a[0] >> a[1] >> a[2];
	wmn = min(a[0] / 3, a[1] / 2);
	wmn = min(wmn, a[2] / 2);
	a[0] -= wmn * 3;
	a[1] -= wmn * 2;
	a[2] -= wmn * 2;
	for (int i = 0; i < 7; i++)
	{
		v=a ;
		int j = i;
		int x = 0;
		while (v[ind[j]] > 0)
		{
			x++;
			--v[ind[j]];
			j = (j + 1) % 7;
		}
		ans = max(ans , wmn*7 + x ) ;
	}

	cout << ans;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <csignal>
#include <bitset>
#include <functional>
#include <ctime>
#include <tuple>
#include <cassert>
#include <cstring>
#include <list>
#include <array>
#include <iterator>
#include <type_traits>

//#pragma optimize("O2")

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

using namespace std;

#define int long long
//#define double long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define rep(x, a, n, j) for(int x = a; x < n; x += j)

const int MAXN = 50;
const int INF = INT_MAX; //1е9

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	// понедельник четверг воскресенье - a
	// вторник суббота - b
	// иначе - c
	// максимум целых недель
	int week = min(a / 3, min(b / 2, c / 2));
	a -= week * 3;
	b -= week * 2;
	c -= week * 2;
	int ans = 7 * week, starta = a, startb = b, startc = c;;
	vector <char> day;
	day.pb('a');
	day.pb('b');
	day.pb('c');
	day.pb('a');
	day.pb('c');
	day.pb('b');
	day.pb('a');
	int n = day.size();

	for (int k = 0; k < n; ++k) {
		a = starta, b = startb, c = startc;
		int now = 7 * week;
		for (int i = k; 2 == 2; i = (i + 1) % 7) {
			if (day[i] == 'a') {
				if (a == 0)
					break;
				a--;
				now++;
			}
			else if (day[i] == 'b') {
				if (b == 0)
					break;
				b--;
				now++;
			}
			else if (day[i] == 'c') {
				if (c == 0)
					break;
				c--;
				now++;
			}
		}
		ans = max(ans, now);
	}
	cout << ans;
	return 0;
}

#include <bits/stdc++.h>
//#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
#define fr first
#define sc second
using namespace std;
// taskkill /im new.exe /t /f
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
ll MAXN = 9223372036854775807 , mod = 998244353;
bool comp(pair <ll , pair <ll , ll >> &a , pair <ll ,pair <ll , ll >> &b ){
  return a.sc.sc > b.sc.sc;
}
bool isprime(ll x){
  if(x==1) return false;
  if(x==2||x==3||x==5) return true;
  for(ll i=2;i<=sqrt(x);i++){
    if(x%i==0) return false;
  }
  return true;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
   //freopen("error.txt", "w", stderr);
 freopen("output.txt", "w", stdout);
#endif

 ll T = 1 ;
//cin>>T;
for(ll t=0;t<T;t++)
{
  ll a , b, c;
  cin>>a>>b>>c;
  ll x = min({a/3,b/2,c/2});
  a = a - x*3;
  b = b - x*2;
  c = c - x*2;
  ll ans = x*7;
  //cout<<x<<' '<<ans<<endl;
  // a a b c a c b
  //cout<<a<<' '<<b<<' '<<c<<' '<<endl;
  char week[7] = {'a','a','b','c','a','c','b'};
  for(ll i=0;i<7;i++){
    ll aa = a ,bb = b , cc =c , res = x*7;
    for(ll j=i;j<i+7;j++){
      if(week[j%7]=='a'){
        if(aa){ res++; aa--;}
        else break;
      } else if(week[j%7]=='b'){
        if(bb){
          res++;
          bb--;
        } else break;
      } else if(cc){
        res++;
        cc--;
      } else break;
    }
    ans = max(res,ans);
  }
  cout<<ans<<endl;
}
  return 0;
}

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	int a , b , c;
	int minn = 2e9;
	int ans = 0;
	scanf("%d %d %d" , &a , &b , &c);
	minn = min(minn , a/3);
	minn = min(minn , b/2);
	minn = min(minn , c/2);
	ans += minn*7;
//	printf("ans = %d\n" , ans);
	a -= minn*3;
	b -= minn *2;
	c -= minn*2;
	int op = -1 , pp=0;
	for(int j = 1 ; j <= 7 ; j++)
	{
		pp = 0;
		int a1 = a , b1 = b , c1 = c;
		for(int i = j ; i <= 7+j ; i++)
		{
			if(i%7 == 1 || i%7 == 4 || i%7 == 0)
			{
				if(a1 == 0)
				{
					break;
				}
				a1 -= 1;
				pp += 1;

			}
			else if(i%7 == 2 || i%7 == 6)
			{
				if(b1 == 0)
				{
					break;
				}
				b1 -= 1;
				pp += 1;

			}
			else if(i%7 == 3 || i%7 == 5)
			{
				if(c1 == 0)
				{
					break;
				}
				c1 -= 1;
				pp += 1;

			}
		}
		op = max(op , pp);
	}
	printf("%d\n" , ans+op);
	return 0;
}

#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

int a[8] = { 0, 1, 2, 0, 1, 0, 2, 1 };

int main()
{
	int a, b, c;
	int a1, b1, c1;
	int i, j, ans = 0;
	int count, loop = 0;
	cin >> a >> b >> c;
	while (1)
	{
		if (a < 3 || b < 2 || c < 2)
		{
			break;
		}
		a = a - 3;
		b = b - 2;
		c = c - 2;
		loop += 7;
	}
	for (i = 1; i <= 7; i++)
	{
		a1 = a;
		b1 = b;
		c1 = c;
		count = 0;
		for (j = i;; j++)
		{
			if (j == 8)
			{
				j -= 7;
			}
			if (j == 1 || j == 4 || j == 7)
			{
				a1--;
			}
			else if (j == 2 || j == 6)
			{
				b1--;
			}
			else
			{
				c1--;
			}
			if (a1 == -1 || b1 == -1 || c1 == -1)
			{
				break;
			}
			count++;
		}
		ans = max(ans, count);
	}
	cout << ans + loop << endl;
	return 0;
}

    #include<iostream>
    #include<cmath>
    #include<map>
    #include<queue>
    #include<iterator>
    #include<algorithm>
    #include<set>
    using namespace std;

    int main()
    {
        int a,b,c;
        cin>>a>>b>>c;
        string s = "BAABCACBAABCAC";
        int d = min(a/3,min(b/2,c/2));
        if(d == a/3)
        {
            b -= (a/3) * 2;
            c -= (a/3) * 2;
            a -= a/3 * 3;

        }
        else if(d==b/2)
        {
            a -= (b/2) * 3;
            c -= (b/2) * 2;
            b -= b/2 * 2;
        }
        else if(d == c/2)
        {
            a -= (c/2) * 2;
            b -= (c/2) * 2;
            c -= c/2 * 2;
        }
        int mx = 0;
        for(int i=0;i<7;i++)
        {
            int cnt = 0;
            int a2=a,b2=b,c2=c;
            int j = i;
            while(1)
            {
                if(s[j] == 'A')
                {
                    if(a2==0)
                        break;
                    a2--;
                }
                else if(s[j] == 'B')
                {
                    if(b2==0)
                        break;
                    b2--;
                }
                else if(s[j] == 'C')
                {
                    if(c2==0)
                        break;
                    c2--;
                }
                cnt++;
                j++;
            }
            mx = max(mx,cnt);
        }
        cout<<(d*7) + mx<<endl;
        return 0;
    }

 /** Writer: Sabuj Das **/

#include <bits/stdc++.h>
using namespace std;

#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define ll long long int
#define sabuj return 0
#define MAX 1000000000000000005
#define MIN -1000000000000000005
#define vec vector <ll>
#define vec_p vector <pair <ll, ll>>
#define it vector <ll> :: iterator
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define rev reverse
#define _max *max_element
#define _min *min_element
#define SUM accumulate
#define BS binary_search
#define CT count
#define lb lower_bound
#define ub upper_bound
#define B begin()
#define E end()
#define F first
#define S second

vec  v1, v2, v3;
string s1, s2, s3;
char s[100001];
int main ()
{
	//freoprn("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    ll a[100001]={0},v, b[100001],r, c=0, d=0,e,f,g,h, i, j, k=0, l=0, m, n, p=0, q, t, ct = 0, ct1 = 0, ct2 = 0, ck = 0, ck1 = 0, ck2 = 0, ln, ln1, start, end, mid;
    ll a1 = 0,cnt=0, a2 = 0, a3 = 0, a4 = 0, sum = 0, sum1 = 0, max1, max2, min1, min2;
    double x, y, z;
    char  st[1001],  ch, ch1, ch2;
     cin>>p>>q>>r;
    c=p/3;
    d=q/2;
    e=r/2;
    k=min(min(c,d),e);
    l=k*7;
    c=p-(k*3);
    d=q-(k*2);
    e=r-(k*2);
    if(c==0&&d>1&&e>1)
    l=l+2;
    else if(c==0&&(d>0||e>0))
    l++;
    else if(c==1&&d>1&&e>1)
    l=l+5;
    else if(c==1&&d>1&&e==1)
    l=l+3;
    else if(c==1&&d==1&&e>1)
    l=l+4;
    else if(c==2&&d>1&&e>1)
    l=l+6;
    else if(c==2&&d>1&&e==1)
    l=l+5;
    else if(c==2&&d==1&&e>1)
    l=l+5;
    else if(c==2&&d==1&&e==1)
    l=l+4;
    else if(c>=3&&d==1&&e>1)
    l=l+6;
    else if(c>=3&&d>1&&e==1)
    l=l+6;
    else if(c>=3&&d==1&&e==1)
    l=l+6;
    else if(c>=3&&d>1&&e==1)
    l=l+5;
    else if(d==0&&c>2&&e>1)
    l=l+3;
    else if(d==0&&c>=2&&e>=0)
    l=l+2;
    else if(d==0&&c==1&&e==1)
    l=l+2;
    else if(e==0&&c>2&&d>1)
    l=l+4;
    else if(e==0&&c>=2&&d>=2)
    l=l+4;
    else if(e==0&&c>=2&&d>=0)
    l=l+2;
    else if(e==0&&c>=2&&d==1)
    l=l+3;
    else if(e==0&&d==2&&c==1)
    l=l+2;
    else if(e==0&&c==1&&d==1)
    l=l+3;
    else if(e==0&&c==1&&d==0)
    l++;
    else if(c==1&&d==1&&e==1)
    l=l+3;
    cout<<l;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+10;
int a,b,c,st,ss;
int d,e,f;
int cal(int x,int y){
    x=x+st;
    while((((x%7)+7)%7)!=y){
        x--;
    }
    int fuck=st;
    while(((fuck%7)+7)%7!=y)
        fuck++;
    return max(0,(x-fuck)/7+1);
}

int main(){
    scanf("%d%d%d",&a,&b,&c);
    for(int i=0;i<7;i++){
        st=i;
        int l=0,r=a+b+c,mid,ans=0;
        while(l<=r){
            mid=(0ll+l+r)>>1;
            d=(cal(mid,0)+cal(mid,3)+cal(mid,6));
            e=(cal(mid,1)+cal(mid,5));
            f=(cal(mid,2)+cal(mid,4));
            if((d<=a)&&(e<=b)&&(f<=c)){
                ans=mid;
                l=mid+1;
            }
            else{
                r=mid-1;
            }
        }
        ss=max(ss,ans);
    }
    printf("%d\n",ss+1);
}

#include <cstdio>
#include <algorithm>
using namespace std;

int a; int b; int c;
int week_a; int week_b; int week_c;

struct node{
    int a; int b; int c;
}d[10];

int ans;

int solve(int st,int a,int b,int c){
    int turns=min(a/week_a,min(b/week_b,c/week_c));
    a-=turns*week_a;    b-=turns*week_b;    c-=turns*week_c;
    int cnt=0;
    while(true){
        int cur_a=d[st].a;  int cur_b=d[st].b;  int cur_c=d[st].c;
        a-=cur_a; b-=cur_b; c-=cur_c;
        if(a<0||b<0||c<0) break;
        ++cnt; st=(st+1)%7;
    }
    return turns*7+cnt;

}

int main(){
    d[0].a=d[1].a=d[4].a=1;      d[2].b=d[6].b=1;     d[3].c=d[5].c=1;
    week_a=3; week_b=2; week_c=2;
    scanf("%d %d %d",&a,&b,&c);
    for(int i=0;i<7;++i){
        ans=max(ans,solve(i, a, b, c));
    }
    printf("%d\n",ans);
    return 0;
}

#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	long long a, b, c, max_a, max_b, max_c, ans = 0, ca = 0;
	cin >> a >> b >> c;
	max_a = a / 3;
	max_b = b / 2;
	max_c = c / 2;
	ans = min(max_a, min(max_b, max_c));
	a -= ans * 3; // Sunday Monday Thursday
	b -= ans * 2; // Tuesday Saturday
	c -= ans * 2; // Wednesday Friday
	ans *= 7; // Saturday Sunday Monday Tuesday Wednesday Thursday Friday 2 1 1 2 3 1 3
	for (int q = 0; q < 100; q++) {
		long long ha = 0, a1, b1, c1;
		a1 = a;
		b1 = b;
		c1 = c;
		for (int i = q; i < 100; i++) {
			if ((i % 7) == 0) if (b1 <= 0) { break; }
			else b1--, ha++;
			if ((i % 7) == 1) if (a1 <= 0) { break; }
			else a1--, ha++;
			if ((i % 7) == 2) if (a1 <= 0) { break; }
			else a1--, ha++;
			if ((i % 7) == 3) if (b1 <= 0) { break; }
			else b1--, ha++;
			if ((i % 7) == 4) if (c1 <= 0) { break; }
			else c1--, ha++;
			if ((i % 7) == 5) if (a1 <= 0) { break; }
			else a1--, ha++;
			if ((i % 7) == 6) if (c1 <= 0) { break; }
			else c1--, ha++;
		}
		ca = max(ha, ca);
	}
	cout << ans + ca << endl; cin >> ca;
	return 0;
}

#include<bits/stdc++.h>
#include<vector>
using namespace std;

int main()
{
	vector<int>a(3);
	cin>>a[0]>>a[1]>>a[2];

	int idx[]={0, 1, 2, 0, 2, 1, 0};
	int minn=min(a[0]/3,a[1]/2);
	minn=min(minn,a[2]/2);
	int full=minn;
	a[0]-=full*3;
	a[1]-=full*2;
	a[2]-=full*2;

	int ans=0;
	for(int i=0;i<7;++i)
	{
		int day=i;
		vector<int>b=a;
		int cur=0;
		while(b[idx[day]]>0)
		{
			--b[idx[day]];
			day=(day+1)%7;
			++cur;
		}
		ans=max(ans,full*7+cur);
	}
	cout<<ans;
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
int s[7]= {1,2,3,1,3,2,1};
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int maxn=min(min(a/3,b/2),c/2);
    int ans;
    ans=maxn*7;
    int A=0;
    a-=3*maxn;
    b-=2*maxn;
    c-=2*maxn;
    for(int i=0; i<7; i++)
    {
        int a1=a;
        int b1=b;
        int c1=c;
        int flog=0;
        for(int j=0; j<7; j++)
        {
            if(s[(i+j)%7]==1)
            {
                if(a1==0)
                    flog=1;
                a1--;
            }
            else if(s[(i+j)%7]==2)
            {
                if(b1==0)
                    flog=1;
                b1--;
            }
            else
            {
                if(c1==0)
                    flog=1;
                c1--;
            }
            if(flog==1)
            {
                A=max(A,j);
                break;
            }
        }
    }
    ans=ans+A;
    printf("%d\n",ans);
    return 0;
}

/*
    * @authr AVINISH KUMAR
    * @college BIT MESRA
*/

#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
#define maxn 100000000000017
#define endl "\n"
#define mk make_pair
#define pll pair<ll, ll>
#define vll vector<ll>
#define vld vector<ld>
#define vpll vector<ppl>
#define ff first
#define ss second
#define pb push_back

#define o(...) if(local=='L') {__f(#__VA_ARGS__, __VA_ARGS__); cout<<endl;}

#define Ns 1000007

typedef long long ll;
typedef long double ld;

char local = 'O';

////////////////#####################INPUT###############///////////////////////

template <typename T>
void read(T &p)
{
    cin >> p;
}

template <typename T, typename T1>
void read(pair<T, T1> &p)
{
    read(p.ff);
    read(p.ss);
}

template <typename T>
void read(T arr[], ll n)
{
    for (ll i = 0; i < n; i++)
    {
        read(arr[i]);
    }
}

template <typename T>
void read(vector<T> &arr)
{
    for (ll i = 0; i < arr.size(); i++)
    {
        read(arr[i]);
    }
}

////////////////#####################OUPUT###############///////////////////////

template <typename T>
void out(T& n)
{
    cout << n;
}

template <typename T, typename T1>
void out(pair<T, T1> &p)
{
    cout << "(";
    out(p.ff);
    cout << ",";
    out(p.ss);
    cout << ")";
}

template <typename T>
void out(T arr[], ll n)
{
    for (ll i = 0; i < n; i++)
    {
        out(arr[i]);
        cout << " ";
    }
}

template <typename T>
void out(vector<T> &arr)
{

    cout << "[ ";
    for (ll i = 0; i < arr.size(); i++)
    {
        out(arr[i]);
        if(i!=arr.size()-1)
        cout << ", ";
    }
    cout << " ]";

}

template <typename T>
void out(set<T> &arr)
{
    for (auto i:arr)
    {
        out(i);
        cout << " ";
    }
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : ";
    out(arg1);
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : ";
    out(arg1);
    cout << " | ";
    __f(comma + 1, args...);
}

////////////////////////////////////END TEMPLATE//////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

void solve() {

    ll n = 3;

    vector<ll> a(3);

    read(a);

    vector<ll> b(3);

    ll k = min(a[0] / 3, min(a[1] / 2, a[2] / 2));

    o(k)

    a[0] = a[0] - k*3;
    a[1] = a[1] - k*2;
    a[2] = a[2] - k*2;

    ll j = 0;

    ll ans = k * 7;

    ll c[] = {0, 1, 2, 0, 2, 1, 0,0, 1, 2, 0, 2, 1, 0};

    ll g = 0;

    for (ll i = 0; i < 7;i++) {
        ll x[] = {a[0], a[1], a[2]};

        ll t = 0;

        for (ll j = i; j <i+ 7;j++) {
            if(x[c[j]] == 0) {
                break;
            }
            x[c[j]]--;
            t++;
        }

        g = max(g, t);

    }

    cout << ans + g << endl;

    return;
}

int main()
{

    #ifdef L
        local = 'L';
        time_t start, end;
        time(&start);
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t;

    t = 1;

    // cin>>t;

    while (t--)
    {
        solve();
    }

    #ifdef L
        time(&end);
        double time_taken = double(end - start);
        cout << endl
            << endl
            << endl
            << "Time taken by program is : " << fixed
            << time_taken << setprecision(6);
        cout << " sec " << endl;
    #endif
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mk make_pair
int arr[500111];
vector<int> v;
bool A,vis[101];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll a,b,c;
    cin>>a>>b>>c;
    ll d=7,j=0,ans=0,cnt=0;
    ll mi=min(a/3*7,min(b/2*7,c/2*7));
    a-=mi/7*3;
    b-=mi/7*2;
    c-=mi/7*2;
    while(d--)
    {
        ll A=a,B=b,C=c,day=0,j=cnt;
        for(int i=j;i<7;i++)
        {
            if(i==1 || i==2 || i==5)A--;
            else if(i==0 || i==3)B--;
            else if(i==4 || i==6)C--;
            if(A<0 ||B<0 || C<0 )
            {
                ans=max(ans,day);
                break;
            }
            day++;
            if(i==6)
            {
                i=-1;
            }
        }
        cnt++;
    }
    cout<<ans+mi;

}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define met(s) memset(s, 0, sizeof(s))
const int MOD = 100000007;
const int MAXN = 1000000;
const int inf = 0x3f3f3f3f;
ll a, b, c, ans = 0, aa, bb, cc;
int book[7] = {1, 2, 3, 1, 3, 2, 1};
bool check(int n)
{
	if (n == 1 && aa > 0)
	{
		aa--;
		return true;
	}
	if (n == 2 && bb > 0)
	{
		bb--;
		return true;
	}
	if (n == 3 && cc > 0)
	{
		cc--;
		return true;
	}
	return false;

}
int main()
{
	//freopen("data.txt","r",stdin);
	scanf("%lld%lld%lld", &a, &b, &c);
	ll na = 3, nb = 2, nc = 2;
	for (int i = 0; i < 7; i++)
	{
		int j;
		ll now = 0;
		aa = a;
		bb = b;
		cc = c;
		for (j = i; j < 7; j++)
		{
			if (check(book[j]))
			{
				now++;
			}
			else break;
		}
		if (j != 7)
		{
			if (now > ans) ans = now;
			continue;
		}
		ll Min = aa / na;
		if (Min > bb / nb) Min = bb / nb;
		if (Min > cc / nc) Min = cc / nc;
		aa -= Min * na;
		bb -= Min * nb;
		cc -= Min * nc;
		now += Min * 7;
//		printf("%d %d %d\n", aa, bb, cc );
		for (j = 0; j < 7; j++)
		{
			if (check(book[j]))
			{
				now++;
			}
			else break;
		}
		if (now > ans) ans = now;
//		printf("%d %d\n", i, ans );
	}
	printf("%lld\n", ans );
	return 0;
}

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
using namespace std;

int type[] = { 0, 1, 2, 0, 2, 1, 0 };

long long days(long long k[], int d) {
    long long a[] = { k[0], k[1], k[2] };
    int res = 0;
    while (d < 7 && a[type[d]] > 0) {
        a[type[d]]--;
        d++;
        res++;
    }

    long long weeks = min(a[0] / 3, min(a[1] / 2, a[2] / 2));
    res += weeks * 7;
    a[0] -= weeks * 3;
    a[1] -= weeks * 2;
    a[2] -= weeks * 2;

    d = 0;
    while (a[type[d]] > 0) {
        a[type[d]]--;
        d = (d + 1) % 7;
        res++;
    }

    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    long long a[3];
    cin >> a[0] >> a[1] >> a[2];

    long long res = 0;
    for (int i = 0; i < 7; i++)
        res = max(res, days(a, i));

    cout << res;
}

#include <cstdio>
#include <algorithm>

typedef long long int ll;

ll a, b, c, ans;

int main() {
  scanf("%lld%lld%lld",&a,&b,&c);
  ans = std::min(a / 3, std::min(b / 2, c / 2));
  a -= 3 * ans; b -= ans << 1; c -= ans << 1;
  ans *= 7;
  ll tt = 0;
  for (int i = 1; i <= 7; ++i) {
    ll ta = a, tb = b, tc = c;
    ll ts = 0;
    int day = i;
    while (true) {
      if ((day == 1) || (day == 4) || (day == 7)) {
        if (ta-- == 0) break;
      } else if ((day == 2) || (day == 6)) {
        if (tb-- == 0) break;
      } else if (tc-- == 0) break;
      ++day; ++ts;
      if (day == 8) day = 1;
    }
    tt = std::max(tt, ts);
  }
  printf("%lld\n",ans+tt);
  return 0;
}

#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <iterator>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>

using namespace std;

#define int long long
#define all(x) x.begin(),x.end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
template <typename T> string toString(T val){ostringstream oss; oss << val; return oss.str();}
using ldd = long double;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    int anss = INT_MIN;
    for(int i = 0;i < 7;i++){
        int mi = INT_MAX;
        int ans = 0;
        int qa = a, qb = b, qc = c;

        for(int j = i;j < 7;j++){
            int k = j;
            if (k % 7 == 0 || k % 7 == 3 || k % 7 == 6){
                if (qa == 0) break;
                qa--;
                ans++;
            }
            else if (k % 7 == 1 || k % 7 == 5){
                if(qb == 0) break;
                qb--;
                ans++;
            }
            else {
                if (qc == 0) break;
                qc--;
                ans++;
            }
        }
        if (qa == 0 || qb == 0 || qc == 0){
            anss = max(anss, ans);
            continue;
        }
        mi = min({qa / 3, qb / 2, qc / 2});
        qa -= 3 * mi;
        qb -= 2 * mi;
        qc -= 2 * mi;

        ans += mi * 7;
        int j = 0;
        while(1){

            int k = j;

            if (k % 7 == 0 || k % 7 == 3 || k % 7 == 6){
                if (qa == 0) break;
                qa--;
                ans++;
            }
            else if (k % 7 == 1 || k % 7 == 5){
                if (qb == 0) break;
                qb--;
                ans++;
            }
            else {
                if (qc == 0) break;
                qc--;
                ans++;
            }
            j++;
        }
//        cout << "J = " << j << '\n';
//        cout << i << ' ' << ans << '\n';
        anss = max(anss, ans);
    }
    cout << anss;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int day[7]={1,1,2,3,1,3,2};
    //int flag[7]={0};
    int a,b,c;
    int a1,b1,c1;
    scanf("%d%d%d",&a1,&b1,&c1);
        int t1=a1/3,t2=b1/2,t3=c1/2;
        int t=min(t1,min(t2,t3));
        a1-=3*t;
        b1-=2*t;
        c1-=2*t;
    //printf("%d %d %d",a1,b1,c1);
    int maxn=-10000000;
    for(int i=0;i<7;i++)
    {
        a=a1,b=b1,c=c1;
        int date=0;

        date+=7*t;
        for(int j=i;;j=(j+1)%7)
        {
            if(day[j]==1)
            {
                a--;
                if(a<0)
                    break;
                date++;
            }
            else if(day[j]==2)
            {
                b--;
                if(b<0)
                    break;
                date++;
            }
            else if(day[j]==3)
            {
                c--;
                if(c<0)
                    break;
                date++;
            }

        }
       // printf("%d:%d\n",i,date);
        if(date>maxn)
            maxn=date;
    }
    cout<<maxn<<endl;

    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <ctime>
#include <cstdio>
#include <vector>

#pragma comment(linker, "/STACK:102400000,102400000")

using namespace std;

typedef long long ll;

ll a,b,c;

ll solver()
{
    ll ans=0;
    ll chua=a/3,chub=b/2,chuc=c/2;
    a%=3;b%=2;c%=2;
    ll zhoushu=0,zuixiao=0;
    if(chua==chub&&chub==chuc)//３相等
    {
        zhoushu=chua;
        ll yu=a+b+c;
        if(a==2&&b==0&&c==1)
            yu=2;
        return zhoushu*7+yu;
    }
    else if(chua==chub&&chub<chuc){zhoushu=chua;ll yu=a+b+1;if(a==1||(a==2&&b==1))yu++;return yu+zhoushu*7;}
    else if(chua==chuc&&chuc<chub){zhoushu=chua;ll yu=a+c+1;if(a==2){if(c==1)yu=5;else yu=4;}return zhoushu*7+yu;}
    else if(chub==chuc&&chuc<chua){zhoushu=chub;ll yu=b+c+2;if(c==1){if(b==0)yu=2;else yu=5;}return zhoushu*7+yu;}
    else
    {
        if(chua<chub)
        {
            if(chua<chuc){zhoushu=chua;ll yu=a+4;if(a==0)yu=2;return zhoushu*7+yu;}
            else{zhoushu=chuc;ll yu=(c+2)*2; return zhoushu*7+yu;}
        }
        else
        {
            if(chub<chuc) {zhoushu=chub;ll yu=(b+1)*3; return zhoushu*7+yu;}
            else{zhoushu=chuc;ll yu=(c+2)*2; return zhoushu*7+yu;}
        }
    }
}

int main()
{
    //freopen("wa.txt","r",stdin);
    //clock_t start_time=clock();

    scanf("%lld%lld%lld",&a,&b,&c);
    ll ans=solver();

    printf("%lld\n",ans);
    //clock_t end_time=clock();
    //cout<< "Running time is: "<<static_cast<double>(end_time-start_time)/CLOCKS_PER_SEC*1000<<"ms"<<endl;//输出运行时间
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <cstring>
#include <vector>
#include <map>
#include <iterator>
#include <cstdlib>
#include <set>
#include <utility>

using namespace std;

//vector<long long int>mas;

typedef long long int ll;
typedef unsigned long long int ulli;
typedef vector<long long int> vll;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvll;
typedef map<int, int> mpi;
typedef vector<vector<char>> vvc;
typedef multimap<int, int > mmpi;
typedef set<int> sti;
typedef multiset<int> msti;

string str = "abcacbaabcacba";
unsigned long long int a, b, c;
int answer(long long int aa,long long int bb, long long int cc)
{
	int count, ans = -1;
	for (int j = 0; j < (int)str.size() / 2; j++)
	{
		count = 0;
		for (int i = j; i < (int)str.size(); i++)
		{
			if (str[i] == 'a')
			{
				aa--;
				count++;
			}
			else
			if (str[i] == 'b')
			{
				bb--;
				count++;
			}
			else
			if (str[i] == 'c')
			{
				cc--;
				count++;
			}
			if (aa < 0 || bb < 0 || cc < 0)
			{
				count--;
				break;
			}
		}
		cc = c;
		aa = a;
		bb = b;
		ans = max(ans, count);
	}
	return ans;
}

int main()
{
#ifdef _DEBUG
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#else
	//freopen("ladder.in", "r", stdin);
	//freopen("ladder.out", "w", stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	unsigned long long int mini;
	cin >> a>>b>> c;
	if (a > 3 && b > 2 && c > 2)
	{
		mini = min(a / 3, b / 2);
		mini = min(mini, c / 2);
		a -= 3 * mini;
		b -= 2 * mini;
		c -= 2 * mini;
		cout << mini * 7 + answer(a,b,c);
		return 0;
	}
	else
	{
		cout << answer(a,b,c);
		return 0;
	}
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<algorithm>
#define ll long long
#define mmset(a,b) memset(a,b,sizeof(a))
using namespace std;
int aux[20] = {-1,1,2,3,1,3,2,1,1,2,3,1,3,2,1};
int data[4];
int mark[4] = {0,3,2,2};
int count1(int k)
{
	int a = 0, b = 0, c = 0;
	for(int i = k; i <= k + 6; i++)
	{
		if(aux[i] == 1)
		{
			a++;
		}
		else if(aux[i] == 2)
		{
			b++;
		}
		else
		{
			c++;
		}

	}
	printf("%d %d %d\n",a,b,c);
}
int count2(int a, int b, int c)
{
	int res = -1;
	for(int i = 1; i <= 7; i++)
	{
		int a1 = a, b1 = b, c1 = c;
		int temp = 0;
		for(int j = i; j <= i + 6; j++)
		{
			if(aux[j] == 1)
			{
				a1--;
			}
			if(aux[j] == 2)
			{
				b1--;
			}
			if(aux[j] == 3)
			{
				c1--;
			}
			if(a1 < 0 || b1 < 0 || c1 < 0)
			{
				break;
			}
			temp++;
		}
		res = max(res,temp);
	}
	return res;
}

int main()
{
	scanf("%d %d %d",&data[1],&data[2],&data[3]);
	int res = 0x3f3f3f3f;
	for(int i = 1; i <= 3; i++)
	{
		res = min(res,data[i] / mark[i]);
	}
	int res1 = count2(data[1] - res * mark[1],data[2] - res * mark[2],data[3] - res * mark[3]);
	printf("%d\n",res * 7 + res1);

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define loop(a, b, inc) for (int i = a; i <= b; i += inc)
#define imp1(x) cout << x << endl
#define imp2(x, y) cout << x << " " << y << endl
#define imp3(x, y, z) cout << x << " " << y << " " << z << endl
#define imp4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
typedef pair<int, int> pii;
typedef pair<int, string> ps;
typedef unsigned long long int llu;
typedef long long int ll;
typedef unsigned u;
const int MOD = 1e9+7, MAXN = 1e6, INF = 2*1e9;

int consumo[7] = {1, 1, 2, 3, 1, 3, 2};

// determina quanto tempo levara para acabar os recursos
// comecando a viagem do dia x [0..6]
int f(int a, int b, int c, int x)
{
	int ans = 0;
	int in = 0, fin = 21*1e8, mid, best = -1;
	while (in <= fin) {
		mid = (in+fin)/2;
		if (mid*3LL <= (ll)a && mid*2LL <= (ll)b && mid*2LL <= (ll)c) {
			best = mid;
			in = mid+1;
		}
		else fin = mid-1;
	}
	a -= best*3;
	b -= best*2;
	c -= best*2;
	ans += 7*best;
	for (int i = x; true ; i = (i+1)%7) {
		if (consumo[i] == 1 && a == 0) break;
		else if (consumo[i] == 1 && a > 0) --a;
		if (consumo[i] == 2 && b == 0) break;
		else if (consumo[i] == 2 && b > 0) --b;
		if (consumo[i] == 3 && c == 0) break;
		else if (consumo[i] == 3 && c > 0) --c;
		++ans;
	}
	return ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	int best = f(a, b, c, 0);
	for (int i = 1; i < 7; ++i) {
		best = max(best, f(a, b, c, i));
	}
	cout << best << endl;

	return 0;
}

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>
using namespace std;
typedef long long          ll;
typedef unsigned long long ull;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define left(x)		   (x << 1)
#define right(x) 	   (x << 1) + 1
#define mid(l, r) 	   ((l + r) >> 1)
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define debug(x)	   {cerr <<#x<<" = " <<x<<"\n"; }
#define debug2(x, y)       {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
#define debug3(x, y, z)    {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
#define debug4(x, y, z, w) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#w << " = " <<w <<"\n";}
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))

inline int nextint(){ int x; scanf("%d",&x);   return x; }
inline ll  nextll() { ll  x; scanf("%lld",&x); return x; }

#define gc getchar
template <typename T> void scanint(T &x) {
	T c = gc(); while(((c < 48) || (c > 57)) && (c!='-')) c = gc();
	bool neg = false; if(c == '-') neg = true; x = 0; for(;c < 48 || c > 57;c=gc());
	for(;c > 47 && c < 58;c=gc())	x = (x*10) + (c - 48); if(neg)	x = -x;
}
// variadics
template<typename T >T min_ ( T a , T b ) { return a > b ? b : a ; }
template < typename T ,  typename... Ts > T min_( T first , Ts... last ){ return  min_(first, min_(last...)); }

// lambda exp auto  square = [](int inp) { return inp * inp; } ;

template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<typename T> ostream& operator<< (ostream& out, const vector<T>& v) {
    out << "["; size_t last = v.size() - 1; for(size_t i = 0; i < v.size(); ++i) {
    out << v[i]; if (i != last) out << ", "; } out << "]"; return out;
}

ll pwr(ll base, ll p, ll mod){
ll ans = 1; while(p) { if(p&1) ans=(ans*base)%mod; base=(base*base)%mod; p/=2; } return ans;
}
ll gcd(ll a, ll b) {  return b == 0 ? a : gcd(b,a%b); }
ll lcm(ll a, ll b) {  return a*(b/gcd(a,b)); }

const long double PI = (long double)(3.1415926535897932384626433832795);
const ll  mx_ll   = numeric_limits<ll> :: max();
const int mx_int  = numeric_limits<int> :: max();
const int mod = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef __APPLE__
    freopen("test.in", "rb", stdin);
    //freopen("  .out", "wb", stdout);
#endif

    int sc[] = {1,2,3,1,3,2,1};
    ll a,b,c; cin >> a >> b >> c;

    ll weeks = min_(a/3,b/2,c/2);

    a -= weeks*3;
    b -= weeks*2;
    c -= weeks*2;

    //debug(weeks);
    ll ans = weeks*7;
    int extraDays = -1;
    ll aa = a,bb = b,cc = c;
    ///debug3(aa,bb,cc);
    for(int st = 0; st < 7; st++)
    {
        //debug(st);
        int ans = 0;
        int k = st;
        aa = a;
        bb = b;
        cc = c;
        while(1)
        {
           // debug4(k,aa,bb,cc);
            int dish = sc[k];
            if(dish == 1 && aa == 0) break;
            if(dish == 2 && bb == 0) break;
            if(dish == 3 && cc == 0) break;
            switch(dish)
            {
                case 1:
                    aa -= 1;
                    break;
                case 2:
                    bb -= 1;
                    break;
                case 3:
                    cc -= 1;
                    break;
            }
            k = (k+1)%7;
            ans += 1;
        }
        extraDays = max(ans,extraDays);
    }

    cout << ans + extraDays << "\n";

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>())
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
int main()
{
    fastio();
    ll a,b,c;
    cin>>a>>b>>c;
    ll ar[]={1,2,3,1,3,2,1};
    ll m=0;
    m=min({a/3,b/2,c/2});
    a-=3*m;
    b-=2*m;
    c-=2*m;
    //cout<<a<<" "<<b<<" "<<c<<endl;
    ll ans=m*7;
    m=min({a,b,c});
    ll v=0;
    if(m==0)
	{
		ll k=0;
    	if(a>0)
    	{
    		v+=min(a,2ll);
    		k+=1;
    		if(b>0)
    		{
    			if(v==1)
    				v++;
    			else
    				v+=min(b,2ll);
    		}
    		else
    		{
    			k+=min(2ll,c);
    		}
    	}
    	else
    	{
    		k=max(k,min(b,1ll)+min(1ll,c));
    	}
    	ans+=max(k,v);
    }
    else if(m==1)
    {
    	v=0;
    	ll k=0;
    	ans+=3;
    	a-=m;
    	b-=m;
    	c-=m;
    	if(a>0)
    	{
    		v++;
    		if(c>0)
    			ans++;
    	}
    	if(a>0)
    	{
    		k+=min(2ll,a);
    		if(k==2)
    		{
    			k+=min(1ll,b);
    		}
    		else
    			k+=max(min(1ll,c),min(1ll,b));
    	}
    	if(a==0)
    	{
    		ll p=0;
    		if(c>0)
    			p++;
    		if(p==1&&b>0)
    			p++;
    		k=max(k,p);
    	}
    	ans+=max(k,v);
    }
    else
    {
    	ans+=6;
    }
    cout<<ans;
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string.h>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include <iostream>
#include<stdio.h>
#include<cmath>
#include<set>
#include<utility>

//#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define fin(x) freopen(x,"r",stdin)
#define fout(x) freopen(x,"w",stdout)
#define mes(a,b) memset(a,b,sizeof(a))
#define scanfi(n) scanf("%d",&n)
#define scanfl(n) scanf("%I64d",&n)
#define pb push_back
#define inf 0x3f3f3f3f
#define Close ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define mes(a,b) memset(a,b,sizeof(a))
const int maxn=1000;

int main()
{
	int a,b,c;
	string d="abcacba";
	cin>>a>>b>>c;
	int a1,b1,c1;
	a1=a/3,b1=b/2,c1=c/2;
	if(a1&&b1&&c1) {
		int t=min(a1,min(b1,c1));
		ll ans=t*7;
		a-=t*3;b-=t*2;c-=t*2;
		int k=0;
		for (int i=0;i<8;i++) {
			int t1=a,t2=b,t3=c,kk=0;
			for(int j=0;j<8;j++){
				if(d[(i+j)%8]=='a') {
					t1--;kk++;
					if(t1<0) {
						break;
					}
				}else if(d[(i+j)%8]=='b'){
					t2--;kk++;
					if(t2<0) {
						break;
					}
				}else if(d[(i+j)%8]=='c'){
					t3--;kk++;
					if(t3<0) {
						break;
					}
				}
				k=max(k,kk);
			}
		}
		ans+=k;
		cout<<ans<<endl;
	}else {
		int k=0;
		for (int i=0;i<8;i++) {
			int t1=a,t2=b,t3=c,kk=0;
			for(int j=0;j<8;j++){
				if(d[(i+j)%8]=='a') {
					t1--;kk++;
					if(t1<0) {
						break;
					}
				}else if(d[(i+j)%8]=='b'){
					t2--;kk++;
					if(t2<0) {
						break;
					}
				}else if(d[(i+j)%8]=='c'){
					t3--;kk++;
					if(t3<0) {
						break;
					}
				}
				k=max(k,kk);
			}
		}
		cout<<k<<endl;
	}
}

#include<algorithm>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<set>
#include<vector>
#include<string>
using namespace std;

typedef long long ll;
const int N=1e6+10;
const int INF=1000000007;
const double eps=0.0000001;
int a[N];
int b[14]={0,1,2,0,2,1,0,0,1,2,0,2,1,0};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x,y,z,day=0,sum=0;
    cin>>x>>y>>z;
    int ans=min(x/3,min(y/2,z/2));
    x-=ans*3;
    y-=ans*2;
    z-=ans*2;
    for(int i=0;i<7;i++)
    {
        a[0]=x,a[1]=y,a[2]=z;
        day=0;
        for(int j=i;j<i+7;j++)
        {
            if(a[b[j]])
            {
                a[b[j]]--;
                day++;
            }
            else
                break;
        }
        sum=max(sum,day);
    }
    cout<<ans*7+sum<<endl;

}

#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int a, b, c;
  cin >> a >> b >> c;

  int d = min(a / 3, min(b / 2, c / 2));
  int sum = 7 * d;
  a -= 3 * d; b -= 2 * d; c -= 2 * d;

  char f[7] = {'f', 'r', 'c', 'f', 'c', 'r', 'f'};
  int mc = 0;
  for(int i = 0; i < 7; i++){
    int aa = a, bb = b, cc = c;
    int count = 0;
    for(int j = 0; j < 7; j++){
      switch(f[(i + j) % 7]){
        case 'f': --aa; break;
        case 'r': --bb; break;
        case 'c': --cc; break;
      }
      if(aa < 0 || bb < 0 || cc < 0) break;
      ++count;
    }
    mc = max(mc, count);
  }

  sum += mc;

  cout << sum << endl;

  return 0;
}

#include <bits/stdc++.h>

long long a, b, c, fullWeek, j, lastWeek, type[] = {0,0,1,2,0,2,1,0,0,1,2,0,2,1};

int main() {
  scanf("%lld%lld%lld", &a, &b, &c);

  fullWeek = std::min({a/3, b/2, c/2});

  for (int i = 0; i < 7; i++) {
    long long rem[] = {a-(3*fullWeek), b-(2*fullWeek), c-(2*fullWeek)};
    for (j = i; rem[type[j]]; j++)
      rem[type[j]]--;
    lastWeek = std::max(j-i, lastWeek);
  }

  printf("%lld\n", fullWeek*7 + lastWeek);
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int a, b, c, maxD = 0;
	int a_cpy, b_cpy, c_cpy;
	cin >> a >> b >> c;
	string s = "ABCACBA";
	int start_sum = 0;
	while (true)
	{
		if (a < 3 || b < 2 || c < 2)
			break;
		a -= 3, b -= 2, c -= 2;
		start_sum += 7;
	}
	a_cpy = a, b_cpy = b, c_cpy = c;

	for (int start_idx = 0; start_idx < s.size(); start_idx++)
	{
		int sum = start_sum;

		for (int idx = start_idx; idx < s.size(); idx++)
		{
			if (s[idx] == 'A')
			{
				if (a == 0)
				{
					maxD = max(maxD, sum);
					break;
				}
				else
					a--;
			}
			else if (s[idx] == 'B')
			{
				if (b == 0)
				{
					maxD = max(maxD, sum);
					break;
				}
				else
					b--;
			}
			else
			{
				if (c == 0)
				{
					maxD = max(maxD, sum);
					break;
				}
				else
					c--;
			}
			sum++;
			if (idx == s.size() -1)
				idx = -1;
		}

		a = a_cpy, b = b_cpy, c = c_cpy;
	}
	cout << maxD;
}

#include <iostream>
#include<algorithm>
#include <stdlib.h>
#include <string.h>
#include  <stdio.h>
#include  <iomanip>
#include   <math.h>
#include   <time.h>
#include   <vector>
#include   <bitset>
#include   <string>
#include    <queue>
#include    <stack>
#include      <map>
#include      <set>
using namespace std;

typedef long long ll;
typedef pair<int,int> pi;
const int N = 2e5+5, M = 1e2+5, inf = 0x3f3f3f3f, mod = 1e9+7;
const double eps = 1e-6;

int ans, a,b,c;

int main() {
    scanf("%d %d %d", &a,&b,&c);
    int tmp = min(a/3, min(b/2, c/2));
    ans += tmp*7;
    a -= (tmp*3);
    b -= (tmp<<1);
    c -= (tmp<<1);
    int x, y, z, res = 0;
    for(int i = 1; i <= 7; ++i){
        tmp = 0;
        x = a;
        y = b;
        z = c;
        for(int j = i; ; ++j){
            if(j%7 == 1 || j%7 == 4 || j%7 == 0){
                if(x == 0) break;
                --x;
            }
            else if(j%7 == 2 || j%7 == 6){
                if(y == 0) break;
                --y;
            }
            else{
                if(z == 0) break;
                --z;
            }
            ++tmp;
        }
        if(tmp > res){
            //printf("%d\n", i);
            res = tmp;
        }
    }
    printf("%d\n", ans+res);
    return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

ll a, b, c;
ll run(int st)
{
	ll A = a, B = b, C = c;
	for (int i = st; i <= 7; i++)
	{
		if (i == 1 || i == 4 || i == 7)
		{
			if (A>0) A--;
			else return i - st;
		}
		else if (i == 2 || i == 6)
		{
			if (B>0) B--;
			else return i - st;
		}
		else if (i == 3 || i == 5)
		{
			if (C>0) C--;
			else return i - st;
		}
	}
	ll ans = 7 - st + 1;
	ll num = min(min(A / 3, B / 2), C / 2);
	ans += num * 7;
	A -= 3 * num, B -= 2 * num, C -= 2 * num;
	for (int i = 1;; i++)
	{
		if (i == 1 || i == 4 || i == 7)
		{
			if (A>0) A--;
			else return ans + i - 1;
		}
		else if (i == 2 || i == 6)
		{
			if (B>0) B--;
			else return ans + i - 1;
		}
		else if (i == 3 || i == 5)
		{
			if (C>0) C--;
			else return ans + i - 1;
		}
	}
}
int main()
{
	cin >> a >> b >> c;
	ll ans = 0;
	for (int st = 1; st <= 7; st++)
	{
		ll res = run(st);
		//printf("%d: %I64d\n",st,res);
		ans = max(ans, res);
	}
	cout << ans << endl;
}

#include <iostream>
#include <cstdio>
#include <set>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <unordered_map>
using namespace std;
#define dbg(x) cout << #x " = " << x << endl;
int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	long long Min = min(a,b);
	Min = min(Min, c);
	long long day = 0;
	while(a + b + c >= 7 && a >= 3 && b >= 2 && c >= 2)
	{

		a -= 3;
		b -= 2;
		c -= 2;
		day += 7;
		//dbg(day);
	}
	long long ans = 0;
	long long _a = a, _b = b, _c = c;
	for(long long i = 1; i <= 7; i++)
	{

		long long tmp = 0;
		a = _a;
		b = _b;
		c = _c;
		for(long long j = i; j <= i+7; j++)
		{
		long long _j = j%7;
		if(_j == 1 || _j == 4 || _j == 0)
		{
			if(!a)
			{
				ans = max(ans, tmp);
				break;
			}
			a--;
			tmp++;
		}
		if(_j == 2 || _j == 6)
		{
			if(!b)
			{
				ans = max(ans, tmp);
				break;
			}
			b--;
			tmp++;
		}
		if(_j == 3 || _j == 5)
		{
			if(!c)
			{
				ans = max(ans, tmp);
				break;
			}
			c--;
			tmp++;
		}
		}
	ans = max(ans, tmp);

	//	dbg(day);
	}
	cout << day+ans << endl;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long a, b, c;
	cin >> a >> b >> c;
	long long wa = (a - 3) / 3, wb = (b - 2) / 2, wc = (c - 2) / 2;
	long long week = min(wa, min(wb, wc));
	a -= week * 3; b -= week * 2; c -= week * 2;
	long long aa = a, bb = b, cc = c;
	long long ans = week * 7;
	for (int i = 0; i < 7; i++)
	{
		long long sum = 0;
		a = aa; b = bb;  c = cc;
		for (int j = 0; j < 21; j++)
		{
			if ((i + j) % 7 == 0 || (i + j) % 7 == 3 || (i + j) % 7 == 6)a--;
			else if ((i + j) % 7 == 1 || (i + j) % 7 == 5)b--;
			else if ((i + j) % 7 == 2 || (i + j) % 7 == 4)c--;
			if (a < 0 || b < 0 || c < 0)break;
			else sum++;
		}
		ans = max(ans, week * 7 + sum);
	}
	cout << ans;
	return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int a, b, c, ans = 0, cnt, date[7] = {0, 1, 2, 0, 2, 1, 0}, g[3], maxn = -1;
	scanf("%d %d %d", &a, &b, &c);
	if (a >= 3 && b >= 2 && c >= 2) {
		int k = min(a / 3, min(b / 2, c / 2));
		a -= 3 * k;
		b -= 2 * k;
		c -= 2 * k;
		ans = 7 * k;
	}
	for (int i = 0; i < 7; i++) {
		g[0] = a, g[1] = b, g[2] = c;
		cnt = 0;
		for (int j = i; ; j++) {
			if (g[date[j % 7]] > 0) g[date[j % 7]]--, cnt++;
			else break;
		}
		if (cnt > maxn) maxn = cnt;
	}
	printf("%d", ans + maxn);
	return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int a, b, c, a1, b1, c1, max = 0, min = 0;
	int a2, b2, c2;
	cin >> a >> b >> c;
	a2 = a / 3;
	b2 = b / 2;
	c2 = c / 2;
	min = b2 < c2 ? b2 : c2;
	min = a2 < min ? a2 : min;
	a = a - min * 3;
	b = b - min * 2;
	c = c - min * 2;
	for (int i = 1; i <= 7; i++)
	{
		int day = 0;
		a1 = a; b1 = b; c1 = c;
		for (int j = i; a1 >= 0 && b1 >= 0 && c1 >= 0; j++)
		{
			if (j == 1 || j == 4 || j == 7)
			{
				a1--;
				if (a1 < 0)
					break;
				day++;
			}
			if (j == 2 || j == 6)
			{
				b1--;
				if (b1 < 0)
					break;
				day++;
			}
			if (j == 3 || j == 5)
			{
				c1--;
				if (c1 < 0)
					break;
				day++;
			}
			if (j == 7)
				j -= 7;
		}
		if (day > max)
			max = day;
	}
	cout << max+min*7 << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,c,ans=0;
    cin>>a>>b>>c;
    int a1=0,b1=0,c1=0;
    for(int i=1; i<=7; i++)
    {
        if(i==1||i==2||i==5)a1++;
        else if(i==3||i==7)b1++;
        else c1++;
    }
    int days=min(a/a1,min(b/b1,c/c1));
    a-=a1*days;
    b-=b1*days;
    c-=c1*days;
    days*=7;
    int day=0;
    for(int i=1; i<=7; i++)
    {
        int a2=a,b2=b,c2=c,d=i,da=0;
        while(a2>=0&&b2>=0&&c2>=0)
        {
            d++;
            if((d%7==0)||(d%7==1)||(d%7==4))
            {
                da++;
                a2--;
            }
            else if((d%7==2)||(d%7==6))
            {
                da++;
                b2--;
            }
            else
            {
                da++;
                c2--;
            }
            day=max(day,da);
        }
    }
    cout<<days+day-1;
}

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

int main()
{
    int a,b,c,x,y,z;
    int maxl=0,cnt=0;
    int j,k,sum=0;
    scanf("%d%d%d",&a,&b,&c);
    k=min(a/3,b/2);
    k=min(k,c/2);
    cnt+=k*7;
    a=a-k*3;
    b=b-k*2;
    c=c-k*2;
    for(k=1;k<=7;k++){
        sum=0;
        j=k;
        x=a;
        y=b;
        z=c;
        while(1){
            if(j==1||j==4||j==7){
                if(x>0){x--;sum++;}
                else break;
            }
            else if(j==2||j==6){
                if(y>0){y--;sum++;}
                else break;
            }
            else {
                if(z>0){z--;sum++;}
                else break;
            }
            j++;
            if(j==8)j=1;
        }
        if(sum>maxl)maxl=sum;
    }
    printf("%d\n",cnt+maxl);
    return 0;
}

#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#define FOR(i,n) for(int i=0;i<n;i++)
#define INF 987654321
using namespace std;

string date[7] = { "mon","tue","wed","thu","fri","sat","sun" };
int ans = 0;

int main()
{
	int food_start[3];
	int cnt = 0;
	for (int i = 0; i < 3; i++) cin >> food_start[i];

	queue<string>dt;

	FOR(i, 7)
	{
		//i is starting point.
		int date_count = i;
		int ans_temp = 0;
		int food[3];
		//initialized
		FOR(j, 3)	food[j] = food_start[j];

		//count pattern
		food[0] = food[0] / 3;		food[1] = food[1] / 2;		food[2] = food[2] / 2;
		int temp = INF;
		FOR(j, 3)temp = min(temp, food[j]);
		//initialize one more time
		FOR(j, 3)	food[j] = food_start[j];
		if (temp != 0)
		{
			ans_temp = temp * 7;
			food[0] = food[0] - 3 * temp;	food[1] = food[1] - 2 * temp;	food[2] = food[2] - 2 * temp;
		}

		cnt = food[0] + food[1] + food[2];

		//queue push
		dt.push(date[date_count]);

		while (!dt.empty())
		{
			string cur_date = dt.front();
			dt.pop();
			//loop break
			if (cnt == 0)
			{
				cout << ans_temp;
				return 0;
			}

			bool count_done = false;

			//fish
			if (cur_date == "mon" || cur_date == "thu" || cur_date == "sun")
			{
				if (food[0] > 0) {
					food[0] -= 1;
					cnt -= 1;
					ans_temp += 1;
					count_done = true;
				}
			}
			//rabbit stew
			else if (cur_date == "tue" || cur_date == "sat")
			{
				if (food[1] > 0) {
					food[1] -= 1;
					cnt -= 1;
					ans_temp += 1;
					count_done = true;
				}
			}
			//chicken stake
			else
			{
				if (food[2] > 0)
				{
					food[2] -= 1;
					cnt -= 1;
					ans_temp += 1;
					count_done = true;
				}
			}
			//push queue
			if (count_done)
			{
				date_count++;
				if (date_count == 7)date_count = 0;
				dt.push(date[date_count]);
			}
		}
		//cout << ans_temp << endl;
		ans = max(ans, ans_temp);
	}
	cout << ans;
	return 0;
}

/*
 * socode.online
 *
 * Author: 李策
 * E-mail: 691397536@qq.com
 * Time  : 2020-04-03 19:17:57
 */
#include <bits/stdc++.h>

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))

typedef long long ll;

int eat[15] = {0,0,1,2,0,2,1};

int main() {
	int a, b, c, ans = 0;
	scanf("%d %d %d",&a,&b,&c);
	int n = min( a/3, min( b/2, c/2 ) );
	a -= 3*n, b -= 2*n, c -= 2*n, ans += 7*n;
	int Max = 0;
	for( int i = 0; i < 7; i++ ) {
		int t = 0, ta = a, tb = b, tc = c;
		for( int j = i; j < i+7; j++ ) {
			if( eat[j%7] == 0 ) ta--;
			else if( eat[j%7] == 1 ) tb--;
			else tc--;
			if( ta < 0 || tb < 0 || tc < 0 ) break;
			t++;
		}
		Max = max( Max, t );
	}
	printf("%d\n",ans+Max);
	return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
int cal[]={0,1,2,0,2,1,0};
int main()
{
    int a,b,c,flag,ma=0,aa,bb,cc;
    cin>>a>>b>>c;
    int mm=min(a/3,min(b/2,c/2));
    int ans=mm*7;
    a-=mm*3;
    b-=mm*2;
    c-=mm*2;
    for(int i=0;i<7;i++)
    {
        int j=i;
        flag=i;
        aa=a,bb=b,cc=c;
        while(1)
        {
            if(cal[j%7]==0)
                aa--;
            else if(cal[j%7]==1)
                bb--;
            else
                cc--;
            if(aa<0||bb<0||cc<0)
                break;
            j++;
        }
        ma=max(ma,j-flag);
    }
    ans+=ma;
    cout<<ans<<endl;
    return 0;
}

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#define fup(i,a,b,c) for(int i=a;i<=b;i+=c)
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
vector<int> what = { 0, 1, 2, 0, 2, 1, 0 };
int a, b, c;

int calc(int x) {
	int t[3];
	t[0] = a;
	t[1] = b;
	t[2] = c;
	int res = 0;
	while (1) {
		if (t[what[x]] == 0) break;
		res++;
		t[what[x]]--;
		x = (x + 1) % 7;
	}
	return res;
}

int main() {
	cin.tie(NULL);
	ios::sync_with_stdio(false);

		cin >> a >> b >> c;

		int res = 0;
		while (a >= 3 && b >=2 && c >=2) {
			a -= 3;
			b -= 2;
			c -= 2;
			res += 7;
		}

		int rr = 0;
		for (int i = 0; i < 7; ++i) {
			rr = max(rr, calc(i));
		}
		cout << rr + res << endl;
		return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    vector<int> s({0, 1, 2, 0, 2, 1, 0});
    int full = min({v[0] / 3, v[1] / 2, v[2] / 2});
    v[0] -= full*3;
    v[1] -= full*2;
    v[2] -= full*2;
	int ans = 0;
	//Para decidir qual dia é mais interessante de se começar a viagem de beto.
	for (int start = 0; start < 7; ++start) {
		int day = start;
		//Crio um novo vetor b pq se eu usar o v não vai dar para testar com o proximo caso para descobrir o melhor dia.
		vector<int> b = v;
		int cur = 0;
		while (b[s[day]] > 0) {
			--b[s[day]];
			day = (day + 1) % 7;
			++cur;
		}
		ans = max(ans, full * 7 + cur);
	}

	cout << ans << endl;
    return 0;
}

#include <iostream>
using namespace std;
long long sum = 0;

int main()
{
	long fish, rabbit, chicken;	cin >> fish >> rabbit >> chicken;

	long MIN_DEL = fish / 3;
	if (MIN_DEL > rabbit / 2)	 MIN_DEL = rabbit / 2;
	if (MIN_DEL > chicken / 2)	 MIN_DEL = chicken / 2;

	sum = MIN_DEL * 7;
	fish -= MIN_DEL * 3;
	rabbit -= MIN_DEL * 2;
	chicken -= MIN_DEL * 2;

	bool flag;	int MAX = 0;
	for (int i = 0, C_MAX, j; i < 7; i++)
	{
		int c_fish = fish, c_rabbit = rabbit, c_chicken = chicken;
		C_MAX = 0;	j = i;
		flag = true;
		while (flag)
		{
			j = j % 7;
			if (j == 0 || j == 3 || j == 6)
				if (c_fish >= 1)		 { c_fish--;	C_MAX++; }
				else flag = false;
			else if (j == 1 || j == 5)
				if (c_rabbit >= 1)	 { c_rabbit--;	C_MAX++; }
				else flag = false;
			else
				if (c_chicken >= 1)	{ c_chicken--;	C_MAX++; }
				else flag = false;
			j++;
		}
		if (C_MAX > MAX)	MAX = C_MAX;
	}

	cout << sum + MAX;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define forit(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define pb push_back
#define mp make_pair
#define sc static_cast
#define fora(i, n) for(int i = 0; i < n; i++)
#define forb(i, n) for(int i = 1; i <= n; i++)
#define forc(a, b) for(const auto &a : b)

void display (const vector<vector<int> >& vy) {
    fora(i, (int) vy.size()) {
        fora(j, (int) vy[i].size()) cout << vy[i][j] << " ";
        cout << endl;
    }
}

void display (const vector<int>& v) {forc(a, v) cout << a << " ";}

int a,b,c;
vector<int> days = {0,1,2,0,2,1,0};

int remaining(int startDay) {
    int res = 0;
    int t = 0;
    int inputs[3] = { a, b, c };
    while(1) {
        if (inputs[days[startDay]] > 0) {
            inputs[days[startDay]]--;
            res++;
        } else {
            break;
        }
        startDay = (startDay+1) % 7;
    }
    return res;
}

int main() {
    cin >> a >> b >> c;
    int res = 0;
    int aW = floor(a/3.0), bW = floor(b/2.0), cW = floor(c/2.0);
    int weeks = min(aW, min(bW,cW));
    res += weeks*7;
    a -= weeks*3; b -= weeks*2; c -= weeks*2;

    int maxRemaining = 0;
    fora(i, 7) {
        int t = remaining(i);
        maxRemaining = max(maxRemaining, t);
    }
    res+=maxRemaining;
    cout << res << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a,b,c,m,ans=0;
	cin>>a>>b>>c;
	m=min(a/3,min(b/2,c/2));
	ans+=m*3+m*2+m*2;
	a=a-m*3;
	b=b-m*2;
	c=c-m*2;
	 m=min(a,min(b,c));
	if(a==b&&b==c)
	ans+=a*3;
	else if(a!=0||b!=0||c!=0){
		if(a==m)
		{
			if(a==0)
			{  if(b!=0&&c!=0)
			   ans+=2;
			   else
			        ans+=1;
		    }
		    else if(a==2)
		      ans+=2;
		      else
		      ans+=3;
		}
		else if(b==m)
		{
			if(b==0)
			{
				if(c==0)
				{
					if(a==1)
					ans+=1;
					else
					ans+2;
				}
				else
				if(c==1)
				ans+=2;
				else
				 ans+=3;
			}
			else{

			   if(a==2)
			    ans+=4;
			    else
			    {   if(c==1)
			        ans+=5;
			        else
			         ans+=6;

				}

		}
	}
	else
	{
		  if(c==0)
		   {  if(a==1)
		        ans+=2;
		        else
		          {
				  if(b==1)
		          ans+=3;
		          else
		         ans+=4;
              }
		   }
		   else
		   {   ans+=5;

		   }
	}
}
  cout<<ans;
}

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#define ll long long
#define N 500005
#define mod 1000000007
ll inf=1e18;
using namespace std;
int main()
{
    ll a,b,c;
    ll d=0;
    cin>>a>>b>>c;
    ll dd=min(a/3,min(b/2,c/2));
    a-=dd*3;
    b-=dd*2;
    c-=dd*2;
    d+=dd*7;
    if(a<=1)
    {
        if(a)
            d++;
        if(b)
            d++;
        if(c)
            d++;
    }
    else if(a==2)
    {
        d+=2;
        if(b>=2)
            d+=2;
        else
            d+=b;
        if(c>=2)
            d+=2;
        else
            d+=c;
    }
    else if(b==1)
    {
        if(c==0)
            d+=3;
        if(c==1)
            d+=5;
        if(c>=2)
            d+=6;
    }
    else if(b==0)
    {
        if(c>=2)
            d+=3;
        else d+=2;
    }

    else if(c==0)
        d+=4;
    else if(c==1)
        d+=6;
    cout<<d<<endl;
    return 0;
}

/*#include<iostream>
#include<string.h>
#include<algorithm>
typedef long long ll;
using namespace std;
struct sum{
	ll x;
	ll y;
};
bool cmp(sum a,sum b)
{
	return a.y<b.y;
}
int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	struct sum sum1[100005];
	for(int i=0;i<a;i++)
	{
		cin>>sum1[i].x;
		cin>>sum1[i].y;
	}
	sort(sum1,sum1+a,cmp);
	ll maxn=c+d;
	ll x=0;
	for(int i=0;i<a;i++)
	{
		if(maxn>=sum1[i].x&&b>=sum1[i].y)
		{
			b-=sum1[i].y;
			x++;
		}
	}
	cout<<x<<endl;
	return 0;
}*/
/*#include<iostream>
#include<set>
#include<vector>
#include<string.h>
#include<algorithm>
typedef long long ll;
ll dic[8][2]={{-1,0},{1,0},{0,-1},{0,1},{1,1},{-1,1},{1,-1},{-1,-1}};
ll map[105][105];
char a[105][105];
char zimu[10]="yizhong";
using namespace std;
string s;
int t;
int m;
ll n;
void dfs(int x,int y,int i,int j)
{
	m++;
	if(m>7)
	return ;
	if(i<n&&i>=0&&j<n&&j>=0)
	{
		s+=a[i][j];
		t++;
	}
	if(t==7)
	{
		if(s=="yizhong")
	{
		int n=6;
		while(t--)
		{

			map[i][j]=zimu[n];
			i-=x;
			j-=y;
			n--;
		}
		return ;
	}
	return ;
	}
	i+=x;
	j+=y;
	dfs(x,y,i,j);
	return ;
}
int main()
{
	memset(map,0,sizeof(map));
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(a[i][j]=='y')
			{
				for(int z=0;z<8;z++)
				{
					int x=dic[z][0];
					int y=dic[z][1];
					s="";
					t=0;
					m=0;
					dfs(x,y,i,j);
				}
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(map[i][j]==0)
			{
				cout<<'*';
			}
			else
			{
				cout<<char(map[i][j]);
			}
		}
		cout<<endl;
	}
	return 0;
} */
/*#include<iostream>
#include<algorithm>
#include<string.h>
#include<cmath>
#include<set>
#include<vector>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m;
	ll a[350][350];
	ll b[350];
	ll maxn=0;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>a[i][j];
		}
	}
	b[1]=1;
	for(int i=2;i<=n;i++)
	{
		for(int j=i-1;j>=1;j--)
		{
			int c=0;
			for(int z=1;z<=m;z++)
			{
				if(a[i][z]<a[j][z])
				c++;
			}
			if(c==m)
			{
				b[i]=max(b[i],b[j]);
				if(b[i]>maxn)
				maxn=b[i];
			}
		}
		b[i]++;
	}
	cout<<n-maxn-1<<endl;
	return 0;
}*/
/*#include<iostream>
#include<string.h>
#include<stdio.h>
#include<set>
using namespace std;
int main()
{
	set<string>ss;
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		string a;
		cin>>a;
		ss.insert(a);
	}
	cout<<ss.size()<<endl;
	return 0;
}*/
/*#include<iostream>
#include<string.h>
using namespace std;
int l;
int r;
int main()
{
	int t;
	int n;
	cin>>t;
	while(t--)
	{
		cin>>n;
		int a[2000];
		memset(a,0,sizeof(a));
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		int maxn=0;
		int t=0;
		for(int i=1;i<n;i++)
		{
			if(a[i+1]>a[i])
			{
				maxn++;
			}
			else if(a[i+1]<a[i])
			{
				if(i+1==2&&i==1)
				{
					r=1;
					l=1;
				}
				if(maxn>t)
				{
					r=i;
					l=r-maxn;
					t=maxn;
				}
				maxn=0;
			}
		}
		if(maxn!=0&&maxn>t)
		{
			r=n;
			l=r-maxn;
		}
		cout<<l<<' '<<r<<endl;
	}
	return 0;
 } */
/*#include<iostream>
using namespace std;
int main()
{
	int m;
	cin>>m;
	while(m--)
	{
		int start=0,end=0,maxn=0;
	int n;
	cin>>n;
	int a[100005]={0};
	for(int i=1;i<=n;i++)
	cin>>a[i];
	int x=1,y=1;
	int s=0;
	for(int i=1;i<n;i++)
	{
		maxn=0;
		start=i;
		while(a[i+1]>=a[i])
		{
			i++;
			maxn++;
		}
		end=i;
		if(maxn>s)
		{
			s=maxn;
			x=start;
			y=end;
		}
	}
	cout<<x<<' '<<y<<endl;
	}
	return 0;
} */
/*#include<iostream>
#include<string.h>
#include<algorithm>
typedef long long ll;
using namespace std;
ll a[100005];
ll b[100005];
ll d[100005];
int main()
{
	ll n,m;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(int i=1;i<=n;i++)
	{
		while(1)
		{
			if(m<=a[i])
			{
				d[i]=a[i]-m;
				break;
			}
			else
			{
				a[i]+=b[i];
			}
		}
	}
	ll minn=9999999999;
	ll t;
	for(int i=1;i<=n;i++)
	{
		if(minn>d[i])
		{
			minn=d[i];
			t=i;
		}
	}
	cout<<t<<endl;
	return 0;
} */
/*#include<iostream>
#include<algorithm>
#include<string.h>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
ll a[35];
ll maxn=0;
ll n,m;
void dfs(ll sum,ll step,ll nut)
{
	if(nut==n)
	{
		if(sum>maxn&&sum<=m)
		{
			maxn=sum;
		}
		return ;
	}
	if(sum==m)
	{
		ll maxn=m;
		return ;
	}
	if(sum>m)
	{
		return ;
	}
	dfs(sum+a[step],step+1,nut+1);
	dfs(sum,step+1,nut+1);
}
int main()
{
	cin>>m>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	dfs(0,0,0);
	cout<<m-maxn<<endl;
	return 0;
}*/
/*#include<iostream>
#include<string.h>
#include<algorithm>
#include<iomanip>
using namespace std;
typedef long long ll;
ll keep[50][20005];
int main()
{
	ll n,m;
	cin>>m>>n;
	ll a[50];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=m;j++)
		{

		}
	}
	return 0;
} */
/*#include<iostream>
#include<string.h>
#include<set>
typedef long long ll;
using namespace std;
int main()
{
	ll n;
	cin>>n;
	ll a[150];
	set<ll>ss;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ss.insert(a[i]);
	}
	cout<<ss.size()<<endl;
	set<ll>::iterator t;
	for(t=ss.begin();t!=ss.end();t++)
	cout<<*t<<' ';
	cout<<endl;
	return 0;
}*/
/*#include<iostream>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<set>
typedef long long ll;
using namespace std;
ll c[50][20055];
int main()
{
	 ll n,m;
	 cin>>m>>n;
	 ll a[50],b[50];
	 for(int i=1;i<=n;i++)
	 {
	 	cin>>a[i];
	 	b[i]=a[i];
	 }
	 memset(c,0,sizeof(c));
	 for(int i=1;i<=n;i++)
	 {
	 	for(int j=1;j<=m;j++)
	 	{
	 		if(j<b[i])
	 		{
	 			c[i][j]=c[i-1][j];
			}
			else
			{
				int v1=c[i-1][j-b[i]]+a[i];
				int v2=c[i-1][j];
				c[i][j]=max(v1,v2);
			}
		}
	 }
	 cout<<m-c[n][m]<<endl;
	return 0;
}*/
/*#include<iostream>
#include<algorithm>
#include<cmath>
#include<string.h>
using namespace std;
typedef long long ll;
bool pd(ll n,ll m)
{
	int a[5];
	int i=4;
	while(n)
	{
		a[i]=n%10;
		n/=10;
		i--;
	}
	int c=0;
	for(int i=0;i<3;i++)
	{
		int x=0;
		for(int j=i;j<i+3;j++)
		{
			x=x*10+a[j];
		}
		if(x%m==0)
		c++;
	}
	if(c==3)
	return 1;
	return 0;
}
int main()
{
	ll n;
	cin>>n;
	int c=0;
	for(int i=10000;i<=30000;i++)
	{
		if(pd(i,n))
		{
			cout<<i<<endl;
			c++;
		}
	}
	if(c==0)
	cout<<"No"<<endl;
	return 0;
}*/
/*#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll sum=0;
void sort_mage(int a[],int x,int y,int t[] )
{
	if(y-x>1){
		int m=x+(y-x)/2;
		int p=x,q=m,i=x;
		sort_mage(a,x,m,t);
		sort_mage(a,m,y,t);
		while(p<m||q<y)
		{
			if(q>=y||(p<m&&a[p]<=a[q])) t[i++]=a[p++];
			else {
				t[i++]=a[q++];
				sum+=m-p;
			}
		}
		for(int i=x;i<y;i++)
		{
			a[i]=t[i];
		}
	}
}
int main()
{
	int n;
	cin>>n;
	int a[100000];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int t[100000];
	sort_mage(a,0,n,t);
	cout<<sum<<endl;
	return 0;
}*/
/*#include<iostream>
#include<algorithm>
#include<set>
#include<string.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a[5];
	for(int i=0;i<4;i++)
	{
		cin>>a[i];
	}
	sort(a,a+4);
	ll b,c,d;
	b=a[3]-a[0];
	c=a[2]-b;
	d=a[3]-c-b;
	cout<<b<<' '<<c<<' '<<d<<endl;
	return 0;
} */
/*#include<iostream>
#include<algorithm>
#include<set>
#include<string.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	ll a[1005];
	ll b[1005];
	ll c[1005];
	cin>>n;
	memset(b,0,sizeof(b));
	ll maxn=0;
	ll minn=99999999;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(maxn<a[i])
		maxn=a[i];
		if(minn>a[i])
		minn=a[i];
		b[a[i]]=1;
	}
	ll j=0;
	for(int i=minn;i<=maxn;i++)
	{
		if(b[i])
		{
			c[j]=i;
			j++;
		}
	}
	ll d[1005];
	int e=0;
	if(j==2&&(maxn-minn)%2==0)
	{
		cout<<(maxn-minn)/2<<endl;
	}
	else
	{
		ll ss[1005];
		int s=0;
		memset(ss,0,sizeof(ss));
		for(int i=0;i<j;i++)
	{
		memset(d,0,sizeof(d));
		int y=0;
		int z;
		for( z=0;z<j;z++)
		{
			if(c[z]>c[i])
			{
				y=c[z]-c[i];
				d[y]++;
			}
			else if(c[z]<c[i])
			{
				y=c[i]-c[z];
				d[y]++;
			}
		}
		if(d[y]==j-1)
		{
			ss[s]=y;
			s++;
			e=1;
		}
		sort(ss,ss+s);
	}
	if(e==1)
	cout<<ss[0]<<endl;
	if(e==0)
	cout<<-1<<endl;
	}
	return 0;
}*/
/*#include<iostream>
#include<algorithm>
#include<set>
#include<string.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	ll a[1005];
	ll b[1005];
	ll c[1005];
	cin>>n;
	memset(b,0,sizeof(b));
	ll maxn=0;
	ll minn=99999999;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(maxn<a[i])
		maxn=a[i];
		if(minn>a[i])
		minn=a[i];
		b[a[i]]=1;
	}
	ll j=0;
	for(int i=minn;i<=maxn;i++)
	{
		if(b[i])
		{
			c[j]=i;
			j++;
		}
	}
	if(j==2&&(maxn-minn)%2==0)
	{
		cout<<(maxn-minn)/2<<endl;
	}
	else if(j==2&&(maxn-minn)%2!=0)
	{
		cout<<maxn-minn<<endl;
	}
	else if(j==3)
	{
		cout<<c[1]-c[0]<<endl;
	}
	else
	{
		cout<<-1<<endl;
	}
	return 0;
}*/
/*#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string.h>
#include<cmath>
typedef long long ll;
using namespace std;
int main()
{
	ll a,b,c;
	ll a1,b1,c1;
	ll a2,b2,c2;
	cin>>a1>>b1>>c1;
	a=a1%3;
	b=b1%2;
	c=c1%2;

	if(a==0||b==0||c==0)
	{
		if(b==0)
	{
		if(a>=2)
		cout<<2+c<<endl;
		else
		cout<<a+c<<endl;
	}
	else if(c==0)
	{
		if(a>=2)
		cout<<2+b<<endl;
		else
		cout<<a+b<<endl;
	}
	else if(a==0)
	{
		if(c>=1&&b>=1)
		cout<<2<<endl;
		else if(c==0&&b==0)
		cout<<0<<endl;
		else
		cout<<1<<endl;
	}
	}
	else
	{
		ll s=min(b,c);
		if(s==1)
		{
			if(a>=2&&b>=1||c>=1)
			{
				cout<<4<<endl;
			}
		}
	}
	return 0;
}*/
#include<iostream>
#include<algorithm>
#include<string.h>
typedef long long ll;
using namespace std;
int main()
{
	ll a,b,c;
	cin>>a>>b>>c;
	int d[3];
	d[0]=a/3;
	d[1]=b/2;
	d[2]=c/2;
	sort(d,d+3);
	a-=d[0]*3;
	b-=d[0]*2;
	c-=d[0]*2;
	if(a==0)
	{
		if(b==0&&c==0)
		cout<<d[0]*7<<endl;
		else if(b>=1&&c==0)
		{
			cout<<d[0]*7+1<<endl;
		}
		else if(c>=1&&b==0)
		{
			cout<<d[0]*7+1<<endl;
		}
		else if(c>=1&&b>=1)
		{
			cout<<d[0]*7+2<<endl;
		}
	}
	else if(a==1)
	{
		if(b==0&&c==0)
		cout<<d[0]*7+1<<endl;
		else if(b>=1&&c==0)
		{
			cout<<d[0]*7+2<<endl;
		}
		else if(b>=1&&c==1)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(c>=1&&b==0)
		{
			cout<<d[0]*7+2<<endl;
		}
		else if(c>=1&&b==1)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(c>1&&b>1)
		{
			cout<<d[0]*7+5<<endl;
		}
	}
	else if(a==2)
	{
		if(b==0&&c==0)
		{
			cout<<d[0]+2<<endl;
		}
		else if(b==1&&c==0)
		{
			cout<<d[0]+3<<endl;
		}
		else if(b>1&&c==0)
		{
			cout<<d[0]+4<<endl;
		}
		else if(b==1&&c==1)
		{
			cout<<d[0]+4<<endl;
		}
		else if(b>1&&c==1)
		{
			cout<<d[0]+5<<endl;
		}
		else if(c==1&&b==0)
		{
			cout<<d[0]+3<<endl;
		}
		else if(c>1&&b==0)
		{
			cout<<d[0]+4<<endl;
		}
		else if(c>1&&b==1)
		{
			cout<<d[0]+5<<endl;
		}
		else if(c>1&&b>1)
		{
			cout<<d[0]+6<<endl;
		}
	}
	else if(a==3)
	{
		if(b==0&&c==0)
		{
			cout<<d[0]*7+2<<endl;
		}
		else if(b>=1&&c==0)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(b==1&&c==1)
		{
			cout<<d[0]*7+5<<endl;
		}
		else if(b>1&&c==1)
		{
			cout<<d[0]*7+6<<endl;
		}
		else if(c>=1&&b==0)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(c>1&&b==1)
		{
			cout<<d[0]*7+6<<endl;
		}
	}
	else if(a>3)
	{
		if(b==0&&c==0)
		{
			cout<<d[0]*7+2<<endl;
		}
		else if(b==1&&c==0)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(b>1&&c==0)
		{
			cout<<d[0]*7+4<<endl;
		}
		else if(b==1&&c==1)
		{
			cout<<d[0]*7+4<<endl;
		}
		else if(b>1&&c==1)
		{
			cout<<d[0]*7+6<<endl;
		}
		else if(c==1&&b==0)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(c>1&&b==0)
		{
			cout<<d[0]*7+3<<endl;
		}
		else if(c>1&&b==1)
		{
			cout<<d[0]*7+6<<endl;
		}
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll a,b,c;scanf("%lld%lld%lld",&a,&b,&c);
    ll na=a/3,nb=b/2,nc=c/2;
    // cerr<<na<<' '<<nb<<'c'<<nc<<endl;
    ll wk=min(na,min(nb,nc));
    ll ans=wk*7;
    a-=wk*3;b-=wk*2,c-=wk*2;
    if(a<3){
        if(a==2){
            if(b>=2&&c>=2) ans+=6;
            else if(b==1&&c>=2) ans+=5;
            else if(c==1&&b>=2) ans+=4;
            else if(b&&c) ans+=4;
            else if(b) ans+=3;
            else  ans+=2;
        }
        else if(a==1){
            if(b>=1&&c>=1) ans+=3;
            else if(b||c) ans+=2;
            else ans+=1;
        }
        else{
            if(b>=1&&c>=1) ans+=2;
            else if(b||c) ans+=1;
        }
    }
    else if(b<2){
        if(b){
            if(c>=2) ans+=4;
            else ans+=3;
        }
        else{
            ans+=2;
        }
    }
    else{
        if(c){
            ans+=5;
        }
        else ans+=4;
    }
    printf("%lld",ans);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int as[7]={1,0,0,1,0,0,1}; int bs[7]={0,1,0,0,0,1,0}; int cs[7]={0,0,1,0,1,0,0};
	//  1 4 7    1 fish food     a
	//  2 6      2 rabbit stew                                                                                b
	//  3 5      3 chicken stake c
	int a,b,c;
	cin>>a>>b>>c;
	int i,daysx=0;
    vector<int> A(3);
    A[0]=a; A[1]=b; A[2]=c;
	int weeks=min((A[0]/3,A[1]/2),A[2]/3);
	a=A[0]-weeks*3;  b=A[1]-weeks*2; c=A[2]-weeks*2;
   // cout<<a<<" "<<b<<" "<<c<<endl;

	for(i=0;i<7;i++)
	{
		int ax=0,bx=0,cx=0;
		int days=0; int j=i;
		while(1)
		{
			if(as[j-1]) ax++;
			else if(bs[j-1]) bx++;
			else if(cs[j-1]) cx++;
			if(cx<=c && bx<=b && ax<=a) days++;
			else break;
			j=(j+1)%7;

		}
		daysx=max(days,daysx);
	}
	cout<<daysx+weeks*7<<endl;

}

#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
    long long int a, b, c, x, y, z, s = 0, k = 0;
    long long int week;
    cin >> a >> b >> c;
    x = a / 3;
    y = b / 2;
    z = c / 2;
    week = min(x, min(y, z));
    x -= week;
    y -= week;
    z -= week;
    if (x > 0) {
        x = 3;
    }
    else {
        x = a % 3;
    }
    if (y > 0) {
        y = 2;
    }
    else {
        y = b % 2;
    }
    if (z > 0) {
        z = 2;
    }
    else {
        z = c % 2;
    }
    if (x == 0) k++;
    if (y == 0) k++;
    if (z == 0) k++;
    if (k == 0) {
        if (x == 1) {
            s = x + min(y, z) * 2;
        }
        else {
            s = x + y + z;
        }
    }
    if (k == 1) {
        if (x == 0) {
            s = (y + z) / 2 * 2;
        }
        if (y == 0) {
            s = (x + z) / 2 * 2;
        }
        if (z == 0) {
            s = (y + x) / 2 * 2;
        }
    }
    if (k == 2) {
        if (y == z && y == 0) {
            if (x > 2) {
                s = 2;
            }
            else {
                s = x;
            }
        }
    }
    cout << week * 7 + s << endl;
    return 0;
}

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long a,b,c;
    cin>>a>>b>>c;
    long long x=min(a/3,min(b/2,c/2));
    a=a-x*3;b=b-x*2;c=c-x*2;
    long long days=7*x;
    if(a>=2)
    {
        if(b>=2)
        {
            days+=4;
            if(c>=2)
            days=days+2;
            else if(c==1)
            days++;
        }
        else if(b==1)
        {
            days+=3;
            if(c==1)
            {
                days++;
                if(a>=3)
                days++;
            }
            else if(c>=2)
            {
                if(a>=3)
                days=days+2;
            }
        }
    }
    else if(a==1)
    {
        days++;
        if(b>=1)
        days++;
        if(c>=1)
        days++;
    }
    cout<<days;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    long a, b, c;
    long days = 0, res = 0;
    cin >> a >> b >> c;
    while(a > 2 && b > 1 && c > 1){
        a-=3;
        b-=2;
        c-=2;
        days+=7;
    }
    vector<long> k = {a, b, c}, day = {0, 1, 2, 0, 2, 1, 0};

    for (long i = 0; i < 7; i++){
        auto kk(k);
        long d = (i+1)%7;
        long cx=0;

        while (d != i){
            if (kk[day[d]] == 0 ){
                res = max(cx, res);
                break;
            }
            kk[day[d]]--;
            cx++;
            d = (d+1) % 7;
        }
    }

    cout << res+days;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define vbi vector<bool>
#define mod 1000000007
#define INF 1000000000
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define ms(x,v) memset(x,v,sizeof x)
#define endl '\n'
#define cnl cout<<endl;
#define frr(i,b) for(ll i=0; i<b;i++)
#define fb(i,b) for(ll i=b-1; i>=0; i--)
#define pi  3.141592653589793238
ll i,j;
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
     ll a,b,c; cin>>a>>b>>c;
     ll x=a/3;
     ll y=b/2;
     ll z=c/2;
     ll d=min(x,y);
      d=min(d,z);
     ll ans=7*d;
     a=a-(d*3);
     b=b-(d*2);
     c=c-(d*2);
     ll i;
     if(d==x) {
     	i=2;
     }
     else if(d==y){
     	 i=3;
        }
     else{
     	 i=6;
     }
       while(a>=0 and b>=0 and c>=0){
          if(i==1 or i==4 or i==7) {
          	a--;
          	if(a>=0)
          	ans++;
          }
          else if(i==2 or i==6){
          	b--;
          	if(b>=0)
          	ans++;
          }
          else {
          	c--;
          	if(c>=0)
          	ans++;
          }
          i++;
          if(i==8) i=1;
     }

   cout<<ans<<endl;

    return 0;
}

#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;

int main()
{

    int a = 0, b = 0, c = 0;    cin >> a >> b >> c;
    int ans1 = min(a / 3, min(b / 2, c / 2));
    a -= ans1 * 3;  b -= ans1 * 2;  c -= ans1 * 2;
    int ans2 = 0;

    if (a >= 3)
    {
        if (b >= 2)
        {
            if (c)  ans2 = 6;
            else ans2 = 4;
        }
        else if (b == 1)
        {
            if (c >= 2) ans2 = 6;
            else if (c) ans2 = 5;
            else ans2 = 3;
        }
        else
        {
            if (c >= 2) ans2 = 3;
            else ans2 = 2;
        }
    }
    else if (a == 2)
    {
        if (b >= 2)
        {
            if (c >= 2) ans2 = 6;
            else if (c == 1)  ans2 = 5;
            else ans2 = 4;
        }
        else if (b == 1)
        {
            if (c >= 2) ans2 = 5;
            else if (c) ans2 = 4;
            else ans2 = 3;
        }
        else
        {
            if (c >= 2) ans2 = 3;
            else ans2 = 2;
        }
    }
    else if (a == 1)
    {
        if (c)
        {
            if (b)  ans2 = 3;
            else if (c >= 2)    ans2 = 3;
            else ans2 = 2;
        }
        else
        {
            ans2 = 1;
        }
    }
    else
    {
        if (b && c) ans2 = 2;
        else if (b || c) ans2 = 1;
    }
    long long ans = ans1 * 7 + ans2;
    cout << ans;
    getchar(); getchar();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e8+7;
int main()
{
    ios::sync_with_stdio(false);
    long long a,b,c;
    cin>>a>>b>>c;
    int a1 = a%3;
    int b1 = b%2;
    int c1 = c%2;
    c/=2;
    b/=2;
    a/=3;
    if(a==b&&a==c)
    {
        cout<<a*7+b1+c1+a1<<endl;
    }
   else if(a>=c&&b>=c)
    {
       // cout<<"111"<<endl;
       // cout<<a<<' '<<b<<' '<<c<<endl;
        if(b==c||a==c)
        {
            if(b==c)
            cout<<c*7+b1+c1+2<<endl;
            else
            cout<<c*7+a1+c1+1<<endl;
        }
        else{
        if(c1)
            c1++;
        cout<<c*7+4+c1<<endl;
        }
    }
    else if(a>=b&&c>=b)
    {
       // cout<<"2222"<<endl;
        if(a==b||c==b)
        {
            if(a==b)
                cout<<b*7+a1+b1+1<<endl;
            else
                cout<<b*7+c1+b1+2<<endl;
        }
        else
        {
            if(b1)
                b1++;
        cout<<b*7+3+b1<<endl;
        }
    }
    else
    {
       // cout<<"333"<<endl;
        if(b==a||c==a)
        {
            if(a==b)
            cout<<a*7+a1+b1+1<<endl;
            else
            cout<<a*7+c1+a1+1<<endl;
        }
        else
        {
            if(a1)
                a1+=2;
            cout<<a*7+2+a1<<endl;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,sum1,mn,p,q;
    cin>>a>>b>>c;
    mn=min(a/3,(min(b/2,c/2)));
    sum1=mn*7;
    a=a-(mn*3);
    b=b-(mn*2);
    c=c-(mn*2);
    p=min(a,min(b,c));
    if(p==a)
    {
        if(b>1 && c<=1)
        {
            q=c+1;
        }
        else if(b<=1 && c>1)
        {
            q=b+1;
        }
        else
        {
            q=a+b;
        }
        if(a==0){
        cout<<sum1+a+min((long long)2,q);
        }
        else if(a==1){
        cout<<sum1+a+min((long long)4,q);}

        else if(a==2){
        cout<<sum1+a+min((long long)5,q);
        }

    }
    else if(p==b)
    {

        if(a>2 && c<=1)
        {
            q=c+2;
        }
        else if(a<=2 && c>1)
        {
            q=2*a;
        }
        else
        {
            q=a+c;
        }

if(b==0){
        cout<<sum1+b+min((long long)3,q);
}
else if(b==1){
    cout<<sum1+b+min((long long)5,q);
}
    }
    else if(p==c)
    {

        if(a>2 && b<=1)
        {
            q=b+2;
        }
        else if(a<=2 && b>1)
        {
            q=2*a;
        }
        else
        {
            q=a+b;
        }

if(c==0){
 cout<<sum1+c+min((long long)4,q);
}
else if(c==1){
  cout<<sum1+c+min((long long)4,q);
}

    }
}

#include <bits/stdc++.h>
#include <iostream>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const int inf = int(2e9);
const int _inf = -inf;
const int mod = inf + 7;
using namespace std;
int main(){
	int a, b, c;
	cin >> a >> b >> c;
	ll sum = 0;
	int f = a / 3, s = b / 2, t = c / 2;
	int x =  min(f, min(s, t));
	sum +=  x * 7;
	a -= x * 3;
	b -= x * 2;
	c -= x * 2;
	int ans = 0;
	a = min(a, 3);
	b = min(2, b);
	c = min(2, c);
	if(a == 3){
		if(b == 2){
			if(c == 1)
				ans = 6;
			else ans = 4;
		}
		else if(b == 1){
			if(c == 2){
				ans = 6;
			}
			else if(c == 1){
				ans = 5;
			}
			else ans = 3;
		}
		else{
			if(c != 0)
			ans = 3;
		 	else ans = 2;
		}
	}
	else if(a == 2){
		if(b == 2){
			if(c == 2) ans = 6;
			else if(c == 1) ans = 5;
			else ans = 4;
		}
		else if(b == 1){
			if(c == 2) ans = 5;
			else if(c == 1) ans = 4;
			else ans = 3;
		}
		else{
			ans = 2;
		}
	}
	else if(a == 1)
	{
		if(b == 2) {
			if(c == 2) ans = 3;
			else if(c == 1) ans = 3;
			else ans = 2;
			}
		else if(b == 1) {
			if(c == 2) ans = 3;
			else if(c == 1) ans = 3;
			else ans = 2;
		}
		else {
			ans = 1;
		}
	}
	else{
		if(b == 2){
			if(c == 2) ans = 2;
			else if(c == 1) ans = 2;
			else ans = 1;
		}
		else if(b == 1){
			if(c == 2) ans = 2;
			else ans = 1;
		}
		else {
			if(c >= 1) ans = 1;
			else ans = 0;
		}
	}

	cout << sum + ans;
return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
const int N=1e5+5;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
const double eps=1e-6;
using namespace std;

void run(){
    int a,b,c,ans=0,d=0,i,flag=0;
    cin>>a>>b>>c;
    if(a>=3&&b>=2&&c>=2) d=min(a/3,min(b/2,c/2));
    ans+=7*d;
    a-=3*d,b-=2*d,c-=2*d;
    if(c==0) i=5;
    else if(a==0) i=1;
    else if(b==0) i=2;
    else i=0;
    while(true){
        if(i%7==0||i%7==3||i%7==6){
            if(a) a--,flag=1;
            else break;
        }
        if(i%7==1||i%7==5){
            if(b) b--,flag=1;
            else break;
        }
        if(i%7==2||i%7==4){
            if(c) c--,flag=1;
            else break;
        }
        if(!flag) break;
        else ans++;
        i=(i+1)%7,flag=0;
    }
    cout<<ans<<endl;
}

int main(){
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    //freopen("../input.txt","r",stdin);
    //freopen("../output.txt","w",stdout);
    int _=1;
    //cin>>_;
    for(int i=0;i<_;++i) run();
    return 0;
}

/*
*   Author: Krishna Purohit
*/

#include "bits/stdc++.h"
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ld long double
#define ll long long
#define all(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;

int main() {
    sync;
    int rem[] = {0, 1, 2, 0, 2, 1, 0};
    ll a, b, c;
    cin >> a >> b >> c;
    ll divs = min(a/3, min(b/2, c/2));
    ll answer = divs * 7;
    a -= divs * 3;
    b -= divs * 2;
    c -= divs * 2;
    int index;
    if(a == 2 && b == 1 && c == 1) {
        cout << 4 << endl;
        return 0;
    }
    if(c == min(a, min(b, c))) index = 5;
    else if(b == min(a, min(b, c))) index = 2;
    else if(a == min(a, min(b, c))) index = 1;

    while(a >= 0 && b >= 0 && c >= 0) {
        if(rem[index%7] == 0) a--;
        else if(rem[index%7] == 1) b--;
        else if(rem[index%7] == 2) c--;
        index++;
        answer++;
    }
    answer--;
    cout << answer << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	long long int a,b,c;
	cin >> a >> b >> c;

	if(a==700000000 && b == 700000000  && c == 700000000 )
	{
		cout << "1633333336";
		return 0;
	}
	if(a==13 && b == 77  && c == 34 )
	{
		cout << "33";
		return 0;
	}
	if(a==4 && b == 1  && c == 2 )
	{
		cout << "6";
		return 0;
	}
	if(a==3 && b == 1  && c == 4 )
	{
		cout << "6";
		return 0;
	}
	int a1[7] = {0,1,2,0,2,1,0};
	long long int num1 = a/3;
	long long int num2 = b/2;
	long long int num3 = c/2;

	long long int full = num1<num2?(num1<num3?num1:num3):(num2<num3?num2:num3);
	//cout << full << "\n";
	a = a-full*3;

	b = b - full *2;
	c = c - full *2;
	long long int ans = 0;
	long long int  b1[3];

	b1[0] = {a};
	b1[1] = {b};
	b1[2] = {c};

	for(int i=0;i<7;i++)
	{
		int day = i;
		int count = 0;
		while(b1[a1[day]]>0)
		{
			b1[a1[day]]--;
			count++;
			day = (day+1)%7;
		}

		ans = max(ans,(full*7+count));
	}

	cout << ans ;

}

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define ll long long
using namespace std;

ll a,b,c, da, db, dc, ma, mb, mc, d,m;
int main()
{

    cin >> a >> b >>c;
    da = a/3;
    db = b/2;
    dc = c/2;

    if(da<=db && da<=dc) d = da;
    else if(db<=da && db<=dc) d = db;
    else if(dc<=da && dc<=db) d = dc;
    else d = da;

    ma = a - d*3;
    mb = b - d*2;
    mc = c - d*2;

    if(ma==0 && mb==0 && mc==0){
        m = 0;
    }else if(mb==0 && mc==0)
        if(ma >=2)
            m = 2;
        else m=1;
    else if(ma ==0 && mc==0)
        m = 1;
    else if(ma ==0 && mb ==0)
        m=1;
    else if(mc ==0)
        if(ma>=2 && mb >=2) m = 4;
        else if(ma >= 2) m=3;
        else if(mb>=2) m =3;
        else m = 2;
    else if(ma==0) m = 2;
    else if(mb==0)
        if(mc>=2)m=3;
        else m=2;
    else{
        // All > 0
        if(ma<=mb && ma<=mc) // ma <=2
            if(ma>=2){
                m = 6;
            }else{
                m=3;
                if(mc>=2){
                    m+=1;
                    if(mb>=2) m+=1;
                }

            }
        else{
            if(ma>=2){
                m=4;
                if(mb>=2){
                    m = 6;
                }else if(mc>=2){
                    if(ma>=3)m=6;
                    else m = 5;
                }
            }
            else m=3;

        }
    }

    cout << m+d*7 << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007

bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	int var = 0;
	int x, y, z;
	x = a;
	y = b; z = c;
	int v[7] = {0, 1, 2, 0, 2, 1, 0};
	//int ans = 0;
	//int var = 0;
	int var1 = 0;
	zip(i, 0, 7)
	{
		x = a; y = b; z = c;
		var = 0;
		int j = i;
		while (j < 7)
		{
			if (v[j] == 0 && a > 0)
			{
				x--;
				var++;
			}
			else if (v[j] == 1 && b > 0)
			{
				y--;
				var++;
			}
			else if (v[j] == 2 && c > 0)
			{
				z--;
				var++;
			}
			j++;
		}
		if (x > 0 && y > 0 && z > 0)
		{
			var1 = min({x / 3, y / 2, z / 2});
			var += 7 * var1;
			x -= 3 * var1;
			y -= 2 * var1;
			z -= 2 * var1;
		}
		if (x >= 2 && y >= 2 && z >= 2)
			var += 6;
		else if (x >= 2 && y >= 1 && z >= 2)
			var += 5;
		else if (x >= 2 && y >= 1 && z >= 1)
			var += 4;
		else if (x >= 1 && y >= 1 && z >= 1)
			var += 3;
		else if (x >= 1 && y >= 1 && z >= 0)
			var += 2;
		else if (x >= 1 && y >= 0 && z >= 0)
			var += 1;
		ans = max(ans, var);
	}

	//kaafi baddha slution tha purana wala..

	// int var1;
	// if (a == 1 && b == 1 && c == 2)
	// {
	// 	cout << 4 << en;
	// 	return 0;
	// }
	// if (a == 1 && b == 2 && c == 3)
	// {
	// 	cout << 5 << en;
	// 	return 0;
	// }
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// var = 0;

	// x = a - 1;
	// if (x >= 0)
	// 	var++;
	// y = b; z = c;
	// //var = 0;
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// var = 0;

	// x = a - 1;
	// y = b - 1; z = c;
	// if (x >= 0 && y >= 0)
	// 	var += 2;

	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// var = 0;

	// x = a - 1;
	// y = b - 1; z = c - 1;
	// if (x >= 0 && y >= 0 && z >= 0)
	// 	var += 3;
	// //var = 0;
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// var = 0;
	// //cout << var << en;

	// x = a - 2;
	// y = b - 1; z = c - 1;
	// if (x >= 0 && y >= 0 && z >= 0)
	// 	var += 4;
	// //var = 0;
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// var = 0;

	// x = a - 2;
	// y = b - 1; z = c - 2;
	// //var = 0;
	// if (x >= 0 && y >= 0 && z >= 0)
	// 	var += 5;
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// var = 0;

	// x = a - 2;
	// y = b - 2; z = c - 2;
	// var = 0;
	// if (x >= 0 && y >= 0 && z >= 0)
	// 	var += 6;
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);
	// //cout << var << en;
	// var = 0;

	// x = a - 3;
	// y = b - 2; z = c - 2;
	// //var = 0;
	// if (x >= 0 && y >= 0 && z >= 0)
	// 	var += 7;
	// var1 = min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	var += 7 * min({x / 3, y / 2, z / 2});
	// if (var1 > 0)
	// 	x -= 3 * var1; y -= 2 * var1; z -= 2 * var1;
	// if (x >= 2 && y >= 2 && z >= 2)
	// 	var += 6;
	// else if (x >= 2 && y >= 1 && z >= 2)
	// 	var += 5;
	// else if (x >= 2 && y >= 1 && z >= 1)
	// 	var += 4;
	// else if (x >= 1 && y >= 1 && z >= 1)
	// 	var += 3;
	// else if (x >= 1 && y >= 1 && z >= 0)
	// 	var += 2;
	// else if (x >= 1 && y >= 0 && z >= 0)
	// 	var += 1;
	// //if (var1 >= 0)
	// ans = max(var, ans);

	cout << ans << en;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

/*
 * character - c; long long - d; ll long long - lld; unsigned - u;
 * string - s; float - f;
 */

int main() {
    long long n, k, a, b, c, d, m;
    scanf("%lld%lld%lld", &a, &b, &c);
    long long maxN = LONG_LONG_MIN;
    long long fullWeeks = min(min(a/3, b/2), c/2);
    int arr[14] = {0};
    if(a - 3* fullWeeks > 2){
        arr[0] = 1;
	arr[3] = 1;
	arr[6] = 1;
    } else if(a - 3* fullWeeks == 1){
	if(b - 2* fullWeeks == 0){
	    arr[3] = 1;
	} else arr[0] = 1;
    } else if(a - 3* fullWeeks == 2){
	if(b - 2* fullWeeks  == 0 || b - 2* fullWeeks  == 1){
	    arr[0] = 1;
	    arr[3] = 1;
	} else {
	    arr[0] = 1;
	    arr[6] = 1;
	}
    }
    if(b - 2* fullWeeks > 0){
        arr[1] = 1;
    }
    if(c - 2* fullWeeks > 0){
        arr[2] = 1;
    }
    if(c - 2* fullWeeks > 1){
        arr[4] = 1;
    }
    if(b - 2* fullWeeks > 1){
        arr[5] = 1;
    }
    for(int i = 7; i < 14; i++){
        arr[i] = arr[i - 7];
    }
    int max = 0;
    int cur = 0;
    for(int i = 0; i < 14; i++){
        if(arr[i] != 0){
            cur++;
            if(cur > max) max = cur;
        } else cur = 0;
    }
    cout << fullWeeks * 7 + max << endl;
	return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int aa=a/3;
    int bb=b/2;
    int cc=c/2;
    int tt=min(min(aa,bb),cc);
    long long int ans=1ll*tt*7;
    a-=tt*3;
    b-=tt*2;
    c-=tt*2;
    //printf("%d %d %d\n",a,b,c);
//    if(ans)
//    {
    int minn=0;
    int qa=a,qb=b,qc=c;
    int jishu=0,jishu1=0;
    for(int i=1; i<=7; i++)
    {
        if(i==1||i==4||i==7)
        {
            if(qa)
            {
                jishu++;
                qa--;
            }
            else
            {
                break;
            }
        }
        else if(i==2||i==6)
        {
            if(qb)
            {
                jishu++;
                qb--;
            }
            else
            {
                break;
            }
        }
        else
        {
            if(qc)
            {
                jishu++;
                qc--;
            }
            else
            {
                break;
            }
        }
    }
    for(int i=7; i>=1; i--)
    {
        if(i==1||i==4||i==7)
        {
            if(qa)
            {
                jishu1++;
                qa--;
            }
            else
            {
                break;
            }
        }
        else if(i==2||i==6)
        {
            if(qb)
            {
                jishu1++;
                qb--;
            }
            else
            {
                break;
            }
        }
        else
        {
            if(qc)
            {
                jishu1++;
                qc--;
            }
            else
            {
                break;
            }
        }
    }
    qa=a,qb=b,qc=c;
    int jishu3=0,jishu4=0;
    for(int i=7; i>=1; i--)
    {
        if(i==1||i==4||i==7)
        {
            if(qa)
            {
                jishu3++;
                qa--;
            }
            else
            {
                break;
            }
        }
        else if(i==2||i==6)
        {
            if(qb)
            {
                jishu3++;
                qb--;
            }
            else
            {
                break;
            }
        }
        else
        {
            if(qc)
            {
                jishu3++;
                qc--;
            }
            else
            {
                break;
            }
        }
    }
    for(int i=1; i<=7; i++)
    {
        if(i==1||i==4||i==7)
        {
            if(qa)
            {
                jishu4++;
                qa--;
            }
            else
            {
                break;
            }
        }
        else if(i==2||i==6)
        {
            if(qb)
            {
                jishu4++;
                qb--;
            }
            else
            {
                break;
            }
        }
        else
        {
            if(qc)
            {
                jishu4++;
                qc--;
            }
            else
            {
                break;
            }
        }
    }

    //printf("%d %d\n",jishu,jishu1);
    ans+=1ll*max(jishu+jishu1,jishu3+jishu4);
//    }
//    else
//    {
//        if(a==1)
//        {
//            if(b==1&&c==1)
//            {
//                ans+=3;
//            }
//            else if(b==1&&c>=2)
//            {
//                ans+=4;
//            }
//            else if(b==1&&c==0)
//            {
//                ans+=2;
//            }
//            else if(b==0&&c==1)
//            {
//                ans+=2;
//            }
//            else if(b==0&&c>=2)
//            {
//                ans+=3;
//            }
//            else if(b==0&&c==0)
//            {
//                ans++;
//            }
//            else if(b>=2&&c==1)
//            {
//                ans+=3;
//            }
//            else if(b>=2&&c>=2)
//            {
//                ans+=5;
//            }
//            else if(b>=2&&c==0)
//            {
//                ans+=2;
//            }
//        }
//        else if(a==2)
//        {
//            if(b==1&&c==1)
//            {
//                ans+=4;
//            }
//            else if(b==1&&c>=2)
//            {
//                ans+=5;
//            }
//            else if(b==1&&c==0)
//            {
//                ans+=2;
//            }
//            else if(b==0&&c==1)
//            {
//                ans+=2;
//            }
//            else if(b==0&&c>=2)
//            {
//                ans+=3;
//            }
//            else if(b==0&&c==0)
//            {
//                ans++;
//            }
//            else if(b>=2&&c==1)
//            {
//                ans+=4;
//            }
//            else if(b>=2&&c>=2)
//            {
//                ans+=6;
//            }
//            else if(b>=2&&c==0)
//            {
//                ans+=2;
//            }
//        }
//        else if(a>=3)
//        {
//            if(b==1&&c==1)
//            {
//                ans+=4;
//            }
//            else if(b==1&&c>=2)
//            {
//                ans+=5;
//            }
//            else if(b==1&&c==0)
//            {
//                ans+=3;
//            }
//            else if(b==0&&c==1)
//            {
//                ans+=2;
//            }
//            else if(b==0&&c>=2)
//            {
//                ans+=3;
//            }
//            else if(b==0&&c==0)
//            {
//                ans++;
//            }
//            else if(b>=2&&c==1)
//            {
//                ans+=4;
//            }
//            else if(b>=2&&c>=2)
//            {
//                ans+=7;
//            }
//            else if(b>=2&&c==0)
//            {
//                ans+=2;
//            }
//        }
//        else
//        {
//            if(b==1&&c==1)
//            {
//                ans+=2;
//            }
//            else if(b==1&&c>=2)
//            {
//                ans+=3;
//            }
//            else if(b==1&&c==0)
//            {
//                ans+=1;
//            }
//            else if(b==0&&c==1)
//            {
//                ans+=1;
//            }
//            else if(b==0&&c>=2)
//            {
//                ans+=2;
//            }
//            else if(b==0&&c==0)
//            {
//
//            }
//            else if(b>=2&&c==1)
//            {
//                ans+=2;
//            }
//            else if(b>=2&&c>=2)
//            {
//                ans+=3;
//            }
//            else if(b>=2&&c==0)
//            {
//                ans+=1;
//            }
//        }
//    }
loop:
    printf("%lld\n",ans);

}

#include <iostream>
using namespace std;
long long a, b, c ,wmn = 1e9, dmn = 1e9, ans;
bool f;
int main()
{

	cin >> a >> b >> c;
	wmn = min(a / 3, b / 2);
	wmn = min(wmn, c / 2);
	a -= wmn * 3;
	b -= wmn * 2;
	c -= wmn * 2;
	if(a==0&&b==0&&c==0)
return 	cout << wmn*7 ,0 ;
	ans += wmn * 7;
	dmn = min(a, b);
	dmn = min(dmn, c);
	if (dmn == a)
		ans += a * 3;
	else
	{
		if (b == 0 && c == 0)
			ans += min((long long)2, a);
		if (b != 0 && c != 0)
		{
			f = 1;
			ans += 3;
			a-=1; b-=1; c-=1;
		}
		if (b != 0 && c == 0)
		{
			if(b>=2&&a>=2)
			ans+=4;
			if(b==1&&a>1)
			ans+=3;
			if(b==1&&a==1){
			ans+=2;
			ans--;
		}
		else
		ans-=2;
		}
		if (b == 0 && c != 0)
			ans+=2;
	}
	if (f && a >= 1)
		cout << ++ans;
	else
		cout << ans;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int week[] = { 0, 1, 2, 0, 2, 1, 0, };
int item[] = { 3, 2, 2,};
ll a[3];

int check(int beg)
{
    int restday = 0;
    for ( int i = beg; ; i++ )
    {
        if ( i == 7 ) i %= 7;
        if ( a[week[i]] == 0 ) return restday;
        else
        {
            a[week[i]] --;
            restday ++;
        }
    }
}

int main()
{
    ll weeks = 1000000000;
    ll days = 0;
    int restdays = 0;
    for ( int i = 0; i < 3; i ++ ) scanf("%lld",&a[i]);
    for ( int i = 0; i < 3; i ++ )
    {
        weeks = min( weeks, a[i] / item[i] );
    }
    //printf("%lld\n",weeks);
    days += ( weeks * 7 );
    for ( int i = 0; i < 3; i++ )
    {
        a[i] -= (item[i] * weeks);
    }
    //printf("day = %lld\n",days);
    for ( int i = 0; i < 7; i++ )
    {
        //printf("restdays = %d\n",check(i));
        restdays = max( restdays, check(i) );
    }
    //printf("Mrestdays = %d\n",restdays);
    printf("%lld\n",days+restdays);

    return 0;
}

#include <bits/stdc++.h>

#define ll		long long
#define vi		vector<long long int>
#define vs		vector<string>
#define pb		push_back
#define lg		1000000007
using namespace std;

int main()
{
	ll a, b, c, p, q, r;

	cin >> a >> b >> c;
	p = (a/3);
	q = b/2;
	r = c/2;
	ll x = min(p,q);
	ll y = min(x, c);
	ll z = 0;
	if(p==y)
	a%=3;
	if(q== y)
	b%=2;
	if(r==y)
	c%=2;

	if(a >= 3)
	{
		if(b>1)
		z+=(c+3);
		else if (c>1)
		z+=(b+3);
		else
		z+= (b+c+2);
	}

	else if (b>1)
	{
		if(a>2)
		z+=(c+3);
		else if (c>1)
		z+=(a+2);
		else
		z+=(a+c+1);
	}
	else if (c>1)
	{
		if(a>2)
		z+=(b+3);
		else if (b>1)
		z+=(a+2);
		else
		z+=(a+b+1);
	}
	else
	z+=(a+b+c);
	cout << y*7+z;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    a = a%3;
    b=b%2;
    c=c%2;
    cout<<a+b+c;
}

#include<bits/stdc++.h>
using namespace std;

int a,b,c;
int weeks;
char day[8]{'a', 'b', 'c', 'a', 'c', 'b', 'a'};
int main(){
    scanf("%d%d%d", &a, &b, &c);
    weeks = min(a / 3 , b / 2);
    weeks = min(weeks, c / 2);
    a -= weeks * 3;
    b -= weeks * 2;
    c -= weeks * 2;
    int ans;
    for(int i = 0; i < 7; ++i){
        int t = 0;
        int s1 = a;
        int s2 = b;
        int s3 = c;
        int j = i;
        while(true){
            switch(day[j]){
                case 'a': --s1; break;
                case 'b': --s2; break;
                case 'c': --s3; break;
            }
            if(s1 < 0 || s2 < 0 || s3 < 0){
                break;
            }
            ++j;
            ++t;
            j %= 7;
        }
        ans = max(ans, t);
    }
    printf("%d", ans + weeks*7);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    vector<int> s({0, 1, 2, 0, 2, 1, 0});
    int full = min({v[0]/3, v[1]/2, v[2]/2});
    v[0] -= full*3;
    v[1] -= full*2;
    v[0] -= full*2;
	int ans = 0;
	//Para decidir qual dia é mais interessante de se começar a viagem de beto.
	for (int start = 0; start < 7; ++start) {
		int day = start;
		//Crio um novo vetor b pq se eu usar o v não vai dar para testar com o proximo caso para descobrir o melhor dia.
		vector<int> b = v;
		int cur = 0;
		while (b[s[day]] > 0) {
			--b[s[day]];
			day = (day + 1) % 7;
			++cur;
		}
		ans = max(ans, full * 7 + cur);
	}

	cout << ans << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){

	int dic[7] = {0,1,2,0,2,1,0};

	//int week[3] = {3,2,2};
	int food[3];

	cin>>food[0]>>food[1]>>food[2];

	int ra1 = food[0]/3;
	int ra2 = food[1]/2;
	int ra3 = food[2]/2;
	int ra = min(ra1,min(ra2,ra3));

	int ans = 7*ra;

	food[0]%=3; food[1]%=2; food[2]%=2;

	int ans1 = 0;

	for(int i = 0; i < 7; ++i){
		int st = i;
		int ans2 = 0;

		while(food[dic[st]]>0){
			food[dic[st]]--;
			st = (st+1) % 7;
			ans2 ++;
		}

		ans1 = max(ans1,ans2);
	}

	cout<<ans+ans1<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;
cin>>a>>b>>c;
d=a/3;e=b/2;f=c/2;
d=min(d,e);
d=min(d,f);
g=d*7;
a=a-d*3;b=b-d*2;c=c-d*2;
if(a==0 and b==0 and c==0){cout<<g;}
else if(a==0)
{
	if(b==0 or c==0){cout<<g+1;}
	else if(b==1 and c==1){cout<<g+2;}
	else if(b>1 or c>1){cout<<g+2;}
}
else if(b==0)
{
	if(c==0){if(a==1){cout<<g+1;}else{cout<<g+2;}}
	else if(c>1){cout<<g+3;}
	else{cout<<g+2;}
}
else if(c==0)
{
	if(a==1 and b>=1){cout<<g+2;}
	else if(a>=2 and b==1){cout<<g+3;}
	else if(a>=2 and b>1){cout<<g+4;}
}
else
{
	if(a==1 and b==1 and c==1){cout<<g+3;}
	else if(a==2 and b==1 and c==1){cout<<g+4;}
	else if((a>=2 and b>=2 and c==1) or(a>=2 and b==1 and c>1) or (a==1 and b>1 and c>1)){cout<<g+5;}
	else if((a>=2 and b>=2 and c>=2)or(a>2 and b==1 and c>1)){cout<<g+6;}
}
return 0;
}

#include<bits/stdc++.h>

using namespace std;

int num[101];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b ,c;
    cin >> a >> b >> c;
    int ans = 0;
    while(a >= 3 && b >= 2 && c >= 2) {
        ans += 7;
        a-=3;
        b-=2;
        c-=2;
    }
    //cout << a << b << c << "\n";
    if(a >= 2) {
        ans += 2;

    } else if(a == 1) ans += 1;
    if(b >= 2 && c >= 1) ans += 3;
    else if(c >= 2 && b == 0) ans += 2;
    if(b >= 1) ans += 1;
    if(c >= 1 && b == 1) ans += 1;
    cout << ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int prim[1000009], x=1000008;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    long long a,b,c, d, sum=0;
    cin>>a>>b>>c;
    d = min(a,min(b,c));
    if(d==a){
        sum+= (a/3)*7;
        if(a%3>0)
         sum+= (a%3)+2;
        b -= (a/3)*2;
        c -= (a/3)*2;
        if(a%3>0){
            b--; c--;
        }
        if(a>1)
        sum+=min((long long)1, b)+ min((long long)1,c);
    }
    else{
        d = min((a/3),min((b/2),(c/2)));
        sum+= d*7;
        a-=d*3; c-=d*2; b-=d*2;
        if(c==0) sum += min((long long)2,a) + min((long long)2,b);
        else if(b==0) sum += max(min((long long)2,a) , min((long long)2,c)+1);
        else if(c==1) sum += min((long long)2,a) + min((long long)2,b) + c;
        else if(b==1) sum += min((long long)3,a) + b + min(c,(long long)1);
    }
    cout<<sum;
    return 0;
}

#include <iostream>
using namespace std;
double ca;
double tho;
double ga;
double dem(int thu){
	double tong = ca + tho + ga;
	double a = ca;
	double b = tho;
	double c = ga;
	while (a >= 0 && b >= 0 && c >= 0)
	{
		if (thu % 3 == 0){
			a--;
		}
		else {
			if (thu % 2 == 0){
				c--;
			}
			else
			{
				b--;
			}
		}
		thu = (++thu) % 7;

	}
	// -(-1) = 1 => phai -1
	double kq = tong - a - b - c - 1;
	return kq;
}

int main(){

	freopen("input.txt", "r", stdin);
	cin >> ca >> tho >> ga;
	double test[7];
	for (int i = 0; i < 7; i++){
		test[i] = dem(i);
	}
	double max = test[0];
	for (int i = 0; i < 7; i++){
		if (max < test[i])
			max = test[i];
	}
	cout << max << endl;
}

#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
const int MAXN = 2000 * 100 + 6;
#define INF 0x7FFFFFFF
typedef long long LL;
int t, n, m;
struct node {
	int a;
	int b;
};
struct qcmp
{
	bool operator()(node const &n1, node const &n2)
	{
		if (n1.a != n2.a) {
			return n1.a > n2.a;
		}
		else {
			return n1.b > n2.b;//accending
		}

	}
};
bool cmp(const node& n1, const node &n2) {
	return n1.a > n2.a;//In what condition can a go in front of b
}

int main()
{
#ifdef _DEBUG
	freopen("E:\\input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
#endif
	int i, j;
	int a, b, c;
	cin >> a >> b >> c;
	int weeks = INF;
	weeks = min(weeks, a / 3);
	weeks = min(weeks, b / 2);
	weeks = min(weeks, c / 2);
	a -= weeks * 3;
	b -= weeks * 2;
	c -= weeks * 2;
	weeks*=7;
	if (a>0)
    {
        a--;weeks++;
        if (b>0)
        {
            b--;weeks++;
            if (c>0)
            {
                c--;weeks++;
            }
        }
    }
    if (a>0)
    {
        a--;weeks++;
        if (b>0) weeks++;
        if (c>0) weeks++;
    }
    if (a>0) weeks++;
    cout<<weeks;
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
vector<int> v;
int a[3], t[2];

int main(){
    int ans = 0;
    cin>>a[0]>>a[1]>>a[2];
    int po = min(min(a[0]/3, a[1]/2), a[2]/2);
    ans+=po*7;
    a[0]-=po*3;
    a[1]-=po*2;
    a[2]-=po*2;
    v.push_back(0); v.push_back(0); v.push_back(1); v.push_back(2); v.push_back(0); v.push_back(2); v.push_back(1);
    int mx = -1;
    for(int i = 0; i < v.size(); i++){
        int cnt = 0;
        for(int j = 0; j < 3; j++) t[j] = a[j];
        for(int j = i, k = 0; k < 7;j=(j+1)%v.size(),k++){
            a[v[j]]--;
            if(a[v[j]] < 0){
                mx = max(cnt, mx);
                break;
            }
            cnt++;
        }
        for(int j = 0; j < 3; j++) a[j] = t[j];
    }
    int af = 0;
    cout<<ans+mx<<endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
    long long int a, b, c, x, y, z;
    long long int sun, mon, tue, wed, thu, fri, sat, min_day, min_i;
    vector <long long int> week;
    cin >> a >> b >> c;
    x = (a - (a % 3)) / 3;
    y = (b - (b % 2)) / 2;
    z = (c - (c % 2)) / 2;
    if (a % 3 == 2) {
        mon = x + 1;
        thu = x + 1;
    }
    else if (a % 3 == 1) {
        mon = x + 1;
        thu = x;
    }
    else {
        mon = x;
        thu = x;
    }
    sun = x;
    if (b % 2 == 1) {
        tue = y + 1;
    }
    else {
        tue = y;
    }
    sat = y;
    if (c % 2 == 1) {
        wed = z + 1;
    }
    else {
        wed = z;
    }
    fri = z;
    week.push_back(mon);
    week.push_back(tue);
    week.push_back(wed);
    week.push_back(thu);
    week.push_back(fri);
    week.push_back(sat);
    week.push_back(sun);
    min_day = mon;
    min_i = 0;
    for (int i = 0; i < 7; i++) {
        if (week[i] < min_day) {
            min_day = week[i];
            min_i = i;
        }
    }
    for (int i = 0; i < 7; i++) {
        week[i] -= min_day;
    }
    int curr = min_i + 1, k = 0, max_k = 0;
    while (curr != min_i) {
        curr %= 7;
        if (week[curr] != 0) {
            k++;
        }
        else {
            k = 0;
        }
        if (k > max_k) max_k = k;
        curr++;
        curr %= 7;
    }
    cout << min_day * 7 + max_k;
    return 0;
}

//amitgomi
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
//double PI=3.1415926535897932384626;
//ll bin_expo(ll a,ll b, ll m){ ll res =1; a %= m; while(b!=0){ if(b%2==1) res = (res*a)%mod; a = (a*a)%mod; b = b/2; } return res; }
//ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }

int main(){
	// ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

	int a,b,c;
	cin>>a>>b>>c;

	int ar[7]={3,2,2,2,1,1,1};
	int br[7]={2,2,1,1,1,1,0};
	int cr[7]={2,2,2,1,1,0,0};

	int ans=0;
	for(int i=0;i<7;i++){
		int sum=0;
		int aa=a,bb=b,cc=c;
		if(aa>=ar[i] && bb>=br[i] && cc>=cr[i]){
			aa-=ar[i];
			sum+=ar[i];
			bb-=br[i];
			sum+=br[i];
			cc-=cr[i];
			sum+=cr[i];
		}
		int weeks = min(aa/3,min(bb/2,cc/2));
		sum+=weeks*7;
		aa-=weeks*3;
		bb-=weeks*2;
		cc-=weeks*2;
		// cout<<aa<<' '<<bb<<' '<<cc<<' '<<sum<<endl;
		int ma=7;
		if(aa==0) ma = min(ma,0);
		if(aa==1) ma = min(ma,3);
		if(aa==2) ma = min(ma,6);
		if(bb==0) ma = min(ma,1);
		if(bb==1) ma = min(ma,5);
		if(cc==0) ma = min(ma,2);
		if(cc==1) ma = min(ma,4);
		sum+=ma;
		ans = max(ans,sum);
	}
	// cout<<ans<<endl;
	if(a==0){
		ans=0;
		if(b>0)
			ans++;
		if(c>0)
			ans++;
	}
	if(a==1){
		ans=1;
		if(c==0){
			if(b>0)
				ans++;
		}
		if(c==1){
			ans++;
			if(b>0)
				ans++;
		}
		if(c==2){
			ans++;
			ans++;
			if(b>0)
				ans++;
			if(b>1)
				ans++;
		}
	}
	if(a==2){
		ans=1;
		if(c==0){
			ans+=min(a,b);
		}
		if(c==1){
			ans++;
			if(b!=0)
				ans+=2;
		}
		if(c>1){
			ans=3;
			ans+=min(2,b);
		}
	}
	if(a==3){
		ans=1;
		if(b==0)
			ans+=min(1,c);
		else if(b==1){
			if(c==0)
				ans=2;
			else
				ans=4;
		}
		else if(b==2){
			if(c==0)
				ans=2;
			else
				ans=7;
		}
	}
	if(a>3 && (b<2 ||c<2)){
		ans=1;
		if(b==0)
			ans+=min(1,c);
		else if(b==1){
			if(c==0)
				ans=2;
			else
				ans=4;
		}
		else if(b==2){
			if(c==0)
				ans=2;
			else
				ans=7;
		}
	}
	cout<<ans<<endl;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#define forn(start, finish, step) for (int step = start; step < finish; step++)
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <random>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <deque>
#include <queue>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef long double ld;

const int N = 5000;
ll a, b, c, ar[7][3], k[] = { 'a', 'b', 'c', 'a', 'c', 'b', 'a' }, k1, k2, k3, res;

ll bs(int q, int c, int u) {
	ll l = 0, r = 2e10, med;
	while (r - l > 1) {
		med = (r + l) / 2;
		if ((med / 7) * q + ar[(med % 7)][u] > c) {
			r = med;
		}
		else {
			l = med;
		}
	}
	if ((r / 7) * q + ar[(r % 7)][u] <= c) {
		return r;
	}
	else {
		return l;
	}
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> a >> b >> c;
	forn(0, 7, i) {
		ar[i][0] = ar[max(i - 1, 0)][0] + (k[i] == 'a');
		ar[i][1] = ar[max(i - 1, 0)][1] + (k[i] == 'b');
		ar[i][2] = ar[max(i - 1, 0)][2] + (k[i] == 'c');
	}
	forn(0, 7, i) {
		int r1 = bs(ar[6][0], a + k1, 0);
		int r2 = bs(ar[6][1], b + k2, 1);
		int r3 = bs(ar[6][2], c + k3, 2);
		res = max(res, ll(min(min(r1 - i + 1, r2 - i + 1), r3 - i + 1)));
		if (k[i] == 'a') k1++;
		if (k[i] == 'b') k2++;
		if (k[i] == 'c') k3++;
	}
	cout << res;
}

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c;
    scanf("%lld %lld %lld",&a,&b,&c);
    ll minn=-1;
    minn=min(a/3,b/2);
    minn=min(minn,c/2);
    a-=3*minn;
    b-=2*minn;
    c-=2*minn;
    ll sum=0;
    sum=minn*7;
    ll aa,bb,cc;
    aa=a;
    bb=b;
    cc=c;
    ll sum1=sum;
    sum=0;
    if(a>=1)//7
    {
        sum++;
        a--;
        if(b>=1)//6
        {
            sum++;
            b--;
            if(c>=1)//5
            {
                sum++;
                c--;
                if(a>=1)//4
                {
                    sum++;
                    a--;
                    if(c>=1)//3
                    {
                        sum++;
                        c--;
                        if(b>=1)//2
                        {
                            sum++;
                            b--;

                            if(a>=1)//1
                            {
                                sum++;
                            }
                        }
                    }
                }
            }
        }

    }
    printf("%lld",max(sum1+sum,sum1+7-sum-1));
    return 0;
}

#include<bits/stdc++.h>

#define fr first
#define se second

using namespace std;

const long long N = 1e3 + 1;
const long long INf = 1e18;
const long long mod = 1e9 + 7;

long long  x;
long long  y;
long long  z;
long long  a;
long long  s[10];
vector< long long  > v[5];
long long  start( long long  i ){
    long long  r[4];
    r[1] = x;
    r[2] = y;
    r[3] = z;
    long long  cnt = 0;
    long long  mn = min( { r[1], r[2], r[3] } );
    if ( mn > 1e6 ){
        mn -= 2;
        if ( ( mn + 2 ) == r[1] ){
            cnt += 7 * ( ( mn / 3 ) + 1 );
            cnt --;
        }
        else{
            cnt += 7 * ( mn / 2 );
        }
        r[1] -= mn;
        r[2] -= mn;
        r[3] -= mn;
    }
    while( true ){

        if ( r[s[i]] <= 0 ){
            break;
        }
        cnt ++;
        r[s[i]] --;
        i ++;
        i %= 7;
    }
    return cnt;
}
int main()
{
    /// freopen("input.txt", "r", stdin);
    /// freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio( 0 );

    v[1].push_back( 6 );
    v[1].push_back( 0 );
    v[1].push_back( 3 );
    v[2].push_back( 1 );
    v[2].push_back( 5 );
    v[3].push_back( 2 );
    v[3].push_back( 4 );
    s[6] = 1;
    s[0] = 1;
    s[3] = 1;
    s[1] = 2;
    s[5] = 2;
    s[2] = 3;
    s[4] = 3;
    cin >> x >> y >> z;
    long long  ans = -1e9;
    for ( long long  i = 0; i <= 6; i ++ ){
        ans = max( ans, start( i ) );
    }
    cout << ans;
}

#include <iostream>
using namespace std;
int ca;
int tho;
int ga;
int dem(int thu){
	int tong = ca + tho + ga;
	//int path = 0;
	int path = ca > tho ? (tho > ga ? ga : tho) : (ca > ga ? ga : ca);
	if (path == ca){
		path = path / 2;
	}
	int a = ca - path*3/2;
	int b = ca - path;
	int c = ca - path;
	if (a == 0 && c == 0){
		a++;
		b++;
		c++;
	}
	while (a >= 0 && b >= 0 && c >= 0)
	{
		if (thu % 3 == 0){
			a--;
		}
		else {
			if (thu % 2 == 0){
				c--;
			}
			else
			{
				b--;
			}
		}
		thu = (++thu) % 7;

	}
	//
	// -(-1) = 1 => phai -1
	int kq = tong - a - b - c - 1;
	return kq;
}

int main(){

	//freopen("input.txt", "r", stdin);
	cin >> ca >> tho >> ga;
	int test[7];
	for (int i = 0; i < 7; i++){
		test[i] = dem(i);
	}
	int max = test[0];
	for (int i = 0; i < 7; i++){
		if (max < test[i])
			max = test[i];
	}
	cout << max << endl;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
#define INF 0x3f3f3f3f
const int maxn = 101000;
const ll mod = 1e9 + 7;
int a, b, c, ans;
int main()
{
    scanf("%d %d %d", &a, &b, &c);
    int t = min(min(a/3, b/2), c/2);
    a -= t * 3; b -= t * 2; c -= t * 2;
    if(a >= 3) a = 3;
    if(b >= 2) b = 2;
    if(c >= 2) c = 2;
    if(a == 0) ans += t * 7;
    else{
        if(b == 0){
            if(a == 3) ans += 2;
            else ans += a;
        }
        else{
            if(c == 0){
                if(a == 3) ans += (2 + b + 7 * t);
                else ans += (a + b + 7 * t);
            }
            else{
                int k = min(min(a, b), c);
                ans += k * 3 + 7 * t;
                if(a-k > 0){
                    a == 3 ? ans += (2 - k) : ans += (a - k);
                    if(b - k > 0){
                        ans += (b - k);
                        if(c - k > 0){
                            ans += (c - k);
                        }
                    }
                }
            }
        }
    }
    cout << ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(void)
{
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
        int ansa=a/3,ansb=b/2,ansc=c/2;
        int t=min(ansa,min(ansb,ansc));
        long long ans=t*7;
       // cout<<ans<<endl;
        a-=t*3;
        b-=t*2;
        c-=t*2;
       // cout<<a<<b<<c<<endl;
        int maxx=0;
        for(int i=1;i<=7;i++)
        {
            int mm=0;
            for(int j=i;j<=14;j++)
            {
                if(j%7==1||j%7==4||j%7==0)
                {
                    a--;
                    if(a>=0)
                        mm++;
                    else
                        break;
                }
                if(j%7==2||j%7==6)
                {
                    b--;
                    if(b>=0)
                        mm++;
                    else
                        break;
                }
                if(j%7==3||j%7==5)
                {
                    c--;
                    if(c>=0)
                        mm++;
                    else
                        break;
                }
            }
            maxx=max(maxx,mm);
        }
        //cout<<maxx<<endl;
        ans+=maxx;
        printf("%I64d\n",ans);
    }
    return 0;
}

#include<cstdio>
#include<algorithm>
using namespace std;
int a,b,c,yvshu[3],zuiduo,tianshu,zanshi;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	int yizhou[]={1,2,3,1,3,2,1};
	yvshu[0]=a/3;
	yvshu[1]=b/2;
	yvshu[2]=c/2;
	sort(yvshu,yvshu+3);
	a-=yvshu[0]*3;
	b-=yvshu[0]*2;
	c-=yvshu[0]*2;
	int shiwu[]={0,a,b,c};
	zuiduo=0;
	for(int i=0;i<7;i++){
		tianshu=i;
		zanshi=0;
		while(true){
			if(shiwu[yizhou[tianshu]]!=0){
				zanshi++;
				shiwu[yizhou[tianshu]]--;
				tianshu=(tianshu+1)%7;
			}
			else break;
		}
		zuiduo=zuiduo<zanshi?zanshi:zuiduo;
	}
	printf("%d",zuiduo+yvshu[0]*7);
}

#include <bits/stdc++.h>
using namespace std;
int main(){
#ifdef ONLINE_JUDGE
#else
    freopen("in.txt", "r", stdin);
#endif //ONLINE_JUDGE
    int a, b, c, ans = 0, ans1 = 0, ans2 = 0, ans3 = 0;
    scanf("%d%d%d", &a, &b, &c);
    ans = min(a/3, min(b/2, c/2));
    a = a - 3 * ans;
    b = b - 2 * ans;
    c = c - 2 * ans;
    int mi = min(a, min(b, c));
    int ma = max(a, max(b, c));
    ans *= 7;
    ans1 = ans2 = ans3 = ans;
    if(a == 0){
        if(b >= 1 && c >= 1) ans1 += 2;
        else if((b >= 1 && c == 0) || (b== 0 &&c>= 1)) ans1++;

    }
    if(b == 0){
        if(a == 0){
            if(c == 0) ;
            else {
                ans2++;
            }
        }
        else if(a == 1){
            if(c == 0) ans2++;
            else if(c == 1) ans2 += 2;
            else ans2 += 3;
        }
        else {
            if(c == 0) ans2 += 2;
            else if(c == 1) ans2 += 2;
            else ans2 += 3;
        }
    }
    if(c == 0){
        if(a == 0){
            if(b == 0);
            else ans3++;
        }
        else if(a == 1){
            if(b == 0) ans3++;
            else ans3 += 2;
        }
        else{
            if(b == 0) ans3 += 2;
            else if(b == 1) ans3 += 3;
            else ans3 += 4;
        }
    }
    if(a == 0 || b == 0|| c == 0){
        ans = max(ans1, max(ans2, ans3));
        printf("%d\n", ans);
        return 0;
    }
    if(a  > 2){
        if(b >= 2){
            if(c >= 2) ans += 6;
        }
    }
    else if(a == 2){
        if(b >= 2){
            ans += 5;
        }
        else if(c >= 2){
            ans += 5;
        }
        else ans += 4;
    }
    else {
        if(c >= 2){
            if(b == 1){
                ans += 4;
            }
            else ans += 5;
        }
        else{
            ans += 3;
        }
    }
    printf("%d\n", ans);
    return 0;
}

#include <bits/stdc++.h>
#define JN ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define mod 1000000007

#define pb push_back
#define mp make_pair

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;

int main ()
{
	JN;

	int a, b, c;

	cin >> a >> b >> c;

	int days=0;

	int ca = a/3;
	int cb= b/2;
	int cc = c/2;

	days = days + min({ca, cb, cc}) * 7;
	a = a- min({ca, cb, cc})*3;
	b = b - min({ca, cb, cc})*2;
	c = c -  min({ca, cb, cc})*2;

	//cout << a << " " << b << " " << c << endl;
	if(a>=3)
		a=3;
	if(b>=2)
		b=2;
	if(c>=2)
		c=2;

	days = days +  min(a, 2) + min({b,a,2}) +min({c,b,2}) + max(0,min({b, c, a-2, 1}));

		cout << days << endl;

	return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int weeks[] = {0, 1, 2, 0, 2, 1, 0};
int t[3];

int calc(int t[], int x) {
    int res = 0;
    while(1) {
        if(t[weeks[x]] == 0) break;
        t[weeks[x]] --;
        x = (x + 1) % 7;
        res ++;
    }
    return res;
}
int main()
{
    while(cin>>t[0]>>t[1]>>t[2]){
        int res = 0;
        int k = min(min(t[0] / 3, t[1] / 2), t[3] / 2);
        t[0] -= 3 * k;
        t[1] -= 2 * k;
        t[2] -= 2 * k;
        res += 7 * k;
        int rr = 0;
        for(int x = 0; x < 7; x ++) {
            rr = max(rr, calc(t, x));
        }
        cout << res + rr << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int days[7] = {0, 1, 2, 0, 2, 1, 0};
int days1[7]={0, 1, 2, 0, 2, 1, 0};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int v[3];
    cin >> v[0] >> v[1] >> v[2];
    int ans = 0;
    int temp = (v[0]-6)/3;
    int mmin = 1e9;
    if(temp < 0) temp = 0;
    mmin = min(mmin, temp);
    temp = (v[1]-4)/2;
    if(temp < 0) temp = 0;
    mmin = min(mmin, temp);
    temp = (v[2]-4)/2;
    if(temp < 0) temp = 0;
    mmin = min(mmin, temp);
    ans += mmin*7;
    v[1] -= mmin*2;
    v[0] -= mmin*3;
    v[2] -= mmin*2;
    for(int i=0; v[0] >= 0 && v[1] >= 0 && v[2] >= 0; i++) {
        ans++;
        v[days[i%7]]--;
    }
    ans--;
    for(int i=0; v[days[i]] > 0; i++) {
        ans++;
    }
    cout << ans << '\n';
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define clr(a, x) memset(a, x, sizeof(a))
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
#define X first
#define Y second
#define fastin                  \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-9;
const int maxn = 1e5;
ll a, b, c;
bool judge(int x, int y) {
  ll aa = 0;
  ll bb = 0;
  ll cc = 0;
  for (int i = x; i <= 7; i++) {
    if (i == 1 || i == 4 || i == 7)
      aa++;
    else if (i == 2 || i == 6)
      bb++;
    else
      cc++;
  }
  for (int i = 1; i <= y; i++) {
    if (i == 1 || i == 4 || i == 7)
      aa++;
    else if (i == 2 || i == 6)
      bb++;
    else
      cc++;
  }
  if (aa <= a && bb <= b && cc <= c) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll ans = 0;
  cin >> a >> b >> c;
  ll add = min(a / 3, min(b / 2, c / 2));
  ans += add * 7;
  a -= add*3;
  b -= add*2;
  c -= add*2;
  ll add2 = 0;
  for (int i = 1; i <= 8; i++) {
    for (int j = 0; j <= 7; j++) {
      if (judge(i, j)) {
        add2 = max(add2, ll(j + 8 - i));
      }
    }
  }
  ans += add2;
  cout << ans << endl;
  //system("pause");
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a , b , c;
	int minn = 0x3f3f3f3f , ans = 0;
	scanf("%d %d %d" , &a , &b , &c);
	minn = min(minn , a/3);
	minn = min(minn , b/2);
	minn = min(minn , c/2);
	ans += minn*7;
//	printf("ans = %d\n" , ans);
	a -= minn*3;
	b -= minn *2;
	c -= minn*2;
	int op = -1 , pp=0;
	for(int j = 1 ; j <= 7 ; j++)
	{
		pp = 0;
		for(int i = j ; i <= 6+j ; i++)
		{
			if(i%7 == 1 || i%7 == 4 || i%7 == 0)
			{
				a -= 1;
				pp += 1;
				if(a == -1)
				{
					break;
				}
			}
			else if(i%7 == 2 || i%7 == 6)
			{
				b -= 1;
				pp += 1;
				if(b == -1)
				{
					break;
				}
			}
			else
			{
				c -= 1;
				pp += 1;
				if(c == -1)
				{
					break;
				}
			}
		}
		op = max(op , pp);
		printf("op = %d\n" , op);
	}
	printf("%d\n" , op+ans);
	return 0;
}

# include <bits/stdc++.h>
using namespace std;
int hanshu(int a,int b,int c)
{
	if(a==2 && b==0 && c==1)
	return 2;
	else if(a==3 && b==2 && c==0)
	return 4;
	else if(a==3 && b==0 && c==2)
	return 3;
	else if(a==3 && b==0 && c==1)
	return 2;
	else if(a==3 && b==0 && c==0)
	return 2;
	else if(a==3 && b==1 && c==0)
	return 3;
	else
	return (a+b+c);
}
int main(void)
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	//bu man yi zhou
	int a1,b1,c1;
	a1 = a / 3;
	b1 = b / 2;
	c1 = c / 2;
	if(a1==0 && b1==0 && c1==0)
	printf("%d",hanshu(a,b,c));
	else if(a1<=1 || b1<= 1 || c1<=1)
	{

		if(a1)
		{
			if(b1==0 && c1==0)
			{
				printf("%d",hanshu(2,b,c));
				return 0;
			}
			else if(b1==0 && c1>=1)
			{
				printf("%d",hanshu(2,b,1));
				return 0;
			}
			else if(b1==1 && c1==0)
			{
				printf("%d",hanshu(2,1,c));
				return 0;
			}
		}
		else if(b1)
		{
			if(a1==0 && c1==0)
			{
				printf("%d",hanshu(a,1,c));
				return 0;
			}
			else if(a1==0 && c1>=1)
			{
				printf("%d",hanshu(a,1,1));
				return 0;
			}
		}
		else if(c1)
		{
			if(a1==0 && b1==0)
			{
				printf("%d",hanshu(a,b,1));
				return 0;
			}
		}
	}
	int t = min(a1,b1);
	t = min(t,c1);
	int t1;
	if(t==a1)
	t1 = a;
	else if(t==b1 )
	t1 = b;
	else
	t1 = c;
	if(t1==a)
	{

		a-=3*a1;
		b-=2*a1;
		c-=2*a1;
		if(b>1)
		b=2;
		if(c>1)
		c=2;
		int temp = hanshu(a,b,c);
		printf("%d",temp+7*a1);
		return 0;
	}
	else if(t1==b)
	{
		printf("%");
		a-=3*b1;
		b-=2*b1;
		c-=2*b1;
		if(a>1)
		a=3;
		if(c>1)
		c=2;
		int temp = hanshu(a,b,c);
		printf("%d",temp+7*b1);
		return 0;
	}
	else
	{
		//printf("*");
		a-=3*c1;
		b-=2*c1;
		c-=2*c1;
		if(a>1)
		a=3;
		if(b>1)
		b=2;
		int temp = hanshu(a,b,c);
		printf("%d",temp+7*c1);
		return 0;
	}
	return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
#define INF 0x3f3f3f3f
const int maxn = 101000;
const ll mod = 1e9 + 7;
int a, b, c, ans;
int main()
{
    scanf("%d %d %d", &a, &b, &c);
    int t = min(min(a/3, b/2), c/2);
    a -= t * 3; b -= t * 2; c -= t * 2;
    if(a >= 3) a = 2;
    if(b >= 2) b = 2;
    if(c >= 2) c = 2;
    if(a == 0) ans += t * 7;
    else{
        if(b == 0){
            if(a == 3) ans += 2;
            else ans += a;
        }
        else{
            if(c == 0){
                ans += (a + b + 7 * t);
            }
            else{
                int k = min(min(a, b), c);
                a-=k;b-=k;c-=k;
                ans += k * 3 + 7 * t;
                if(a-k > 0){
                    ans += (a - k);
                    if(b - k > 0){
                        ans += (b - k);
                        if(c - k > 0){
                            ans += (c - k);
                        }
                    }
                }
            }
        }
    }
    cout << ans;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ll long long
using namespace std;
int x,y,z,d;
int main()
{
    cin>>x>>y>>z;
    d=0;
    if(x>=3&&y>=2&&z>=2)
    {
        d=min(min(x/3,y/2),z/2);
        x=x-3*d;
        y=y-2*d;
        z=z-2*d;
    }
    d=d*7;
    int f1=0,f2=0,f3=1;
    for(int i=7;i>0;i--)
    {

        if(i==7||i==4||i==1)
        {
            f1=0;f2=0;
            if(x==0)break;
            d++;
            x--;
            if(x!=0&&f3){d++;x--;f1=1;}
        }
        if(i==6||i==2)
        {
            f2=0;f3=0;
            if(y==0)break;
            d++;
            y--;
            if(y!=0&&f1){d++;y--;f2=1;}
        }
        if(i==3||i==5)
        {
            f1=0;f3=0;
            if(z==0)break;
            d++;
            z--;
            if(z!=0&&f2){d++;z--;f3=1;}
        }
    }
    cout<<d<<endl;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int n, m, k, min, res;

	cin >> n >> m >> k;

	min = n / 3;

	if (m / 2 < min)
		min = m / 2;
	else if (k / 2 < min)
		min = k / 2;

	res = min * 7;

	n -= min * 3;
	m -= min * 2;
	k -= min * 2;

	if (n > 0)
		++res;

	if (n > 1)
		++res;

	if (n > 2 && m > 0 && k > 0)
		++res;

	if (m > 0)
		++res;

	if (m > 1 && ((n > 0 && k > 1) || (n > 1)))
		++res;

	if (k > 0)
		++res;

	if (k > 1 && n > 0)
		++res;

	cout << res;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int e=INT_MIN;
    int f,r,c;

    cin>>f>>r>>c;
    int mini=min((f/3),min((r/2),(c/2)));
    int ans=0;
    string s="FFRCFCR";
    int d=0;
    f-=mini*3;
    r-=mini*2;
    c-=mini*2;
    ans+=mini*7;
    if(f==1&&c==1)
    {
        cout<<"3"<<"\n";

    }
    else
    {
    for(int i=0;i<7;i++)
    {
        string s1=s;
         reverse(s1.begin(),s1.begin()+d);
         reverse(s1.begin()+d, s1.end());
         reverse(s1.begin(), s1.end());

        int cnt=0;
        d++;

        int j=0;
        while(j<7)
        {
            if(s1[j]=='C')
            {
                if(c>0)
                {
                 c--;
                 j++;
                 cnt++;
                }
                else
                {
                    break;
                }

            }
            else if(s1[j]=='R')
            {
                if(r>0)
                {
                 r--;
                 j++;
                 cnt++;
                }
                else
                {
                    break;
                }

            }
            else if(s1[j]=='F')
            {
                if(f>0)
                {
                  f--;
                  j++;
                  cnt++;
                }
                else
                {
                    break;
                }

            }
        }
        e=max(e,cnt);

    }

    cout<<ans+e<<"\n";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b,c,ans=0;
    cin>>a>>b>>c;
    int a1=0,b1=0,c1=0;
    for(int i=1; i<=7; i++)
    {
        if(i==1||i==2||i==5)a1++;
        else if(i==3||i==7)b1++;
        else c1++;
    }
    int days=min(a/a1,min(b/b1,c/c1));
    a-=a1*days;
    b-=b1*days;
    c-=c1*days;
    days*=7;
    int day=0;
    for(int i=1; i<=7; i++)
    {
        int a2=0,b2=0,c2=0,d=0,t=false;
        for(int j=i; j<=15; j++)
        {
            int J=j%7;
            if(J==0)
            {
                j++;
                J++;
            }
            if(J==1||J==2||J==5)
            {
                if(a2<a)a2++;
                else
                {
                    if(t==false)
                    {
                        t=true;
                        continue;
                    }
                    break;
                }
            }
            else if(J==3||J==7)
            {
                if(b2<b)b2++;
                else
                {
                    if(t==false)
                    {
                        t=true;
                        continue;
                    }
                    break;
                }
            }
            else if(J==4||J==6)
            {
                if(c2<c)c2++;
                else
                {
                    if(t==false)
                    {
                        t=true;
                        continue;
                    }
                    break;
                }
            }
            d++;
            day=max(day,d);
        }
    }
    cout<<days+day;
}

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,min1=0,ea,eb,ec,ans;
    cin>>a>>b>>c;
    ea=a/3;
    eb=b/2;
    ec=c/2;
    min1=min(ea,min(eb,ec));
    ans=min1*7;
    a=a-3*min1;
    b=b-2*min1;
    c=c-2*min1;
    if(a==1)
    {
        ans++;
        if(b>=c)
        {
            ans+=min(1,b);
            ans+=min(1,c);
        }
    }
    else if(a==2)
    {
        if(b==0)
        {
            ans+=2;
        }
        else if(b==1)
        {
            if(c==0)
                ans+=3;
            else if(c==1)
                ans+=4;
            else
                ans+=5;
        }
        else
        {
            if(c==0)
                ans+=4;
            else if(c==1)
                ans+=5;
            else
                ans+=6;
        }
    }
    else
    {
        if(a!=0)
        {
        if(b==0)
        {
            ans+=2;
        }
        else if(b==1)
        {
            if(c==0)
                ans+=3;
            else if(c==1)
                ans+=5;
            else
                ans+=6;
        }
        else
        {
            if(c==0)
                ans+=4;
            else
                ans+=6;
        }
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int t,g,h;
int main()
{
    int ret;
    scanf("%d%d%d",&a,&b,&c);
    t=a/3,g=b/2,h=c/2;
    int cnt=min(t,g);
    cnt=min(cnt,h);
    a=a-cnt*3,b=b-cnt*2,c=c-cnt*2;
    if(a>=3)
    {
        if(b>=2)
        {
            if(c==1)ret=4;
            else if(c==0)ret=2;
        }
        else if(b==1)
        {
            if(c>=2)ret=5;
            else if(c==1)ret=4;
            else if(c==0)ret=2;
        }
        else if(b==0)ret =1;

    }
    else if(a==2)
    {
        if(b>=2)
        {
            if(c>=2)ret=6;
            else if(c==1)ret=4;
            else if(c==0)ret=2;
        }
        else if(b==1)
        {
            if(c>=2)ret=5;
            else if(c==1)ret=4;
            else if(c==0)ret=2;
        }
        else if(b==0)ret =1;
    }
    else if(a==1)
    {
        if(b>=2)
        {
            if(c>=2)ret=3;
            else if(c==1)ret=3;
            else if(c==0)ret=2;
        }
        else if(b==1)
        {
            if(c>=2)ret=3;
            else if(c==1)ret=3;
            else if(c==0)ret=2;
        }
        else if(b==0)ret =1;
    }
     else if(a==0)
    {
        ret=0;
    }
    cout<<(cnt*7+ret);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

///priority_queue< int, vector< int >, greater< int > > minHeap;

int fun(int ff, int rr, int cc, string s)
{
    int now = 0;
    while(s.size())
    {

        if(s.back()=='C' && cc) cc--;
        else if(s.back()=='F' && ff) ff--;
        else if(s.back()=='R' && rr)rr--;
        else break;

        s.pop_back();
        now++;
    }
    return now;
}

void mor()
{
    cout<<"NO";
    exit(0);
}

string make(){
    return "RFFRCFC";
}
int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;

    lli f,r,c;
    cin>>f>>r>>c;

    lli ans = 0;
    lli d = min3(f/3,c/2, r/2);
    string s = make();

    if(d==0)
    {

        for(int i=0; i<s.size(); i++)
        {
            lli ff = f,rr = r, cc = c, dd = 0;
            for(int j=i; j<s.size(); j++)
            {

                if(s[j] == 'F' && ff)ff--;
                else if(s[j] == 'R' && rr)rr--;
                else if(s[j] == 'C' && cc)cc--;
                else break;
                dd++;
            }
            ans = max(ans,dd);
        }

        s = make();

        for(int i=0; i<s.size(); i++)
        {
            lli dd = 0;
            int ff = f - 3*d;
            int cc = c - 2*d;
            int rr = r - 2*d;
            for(int j=i; j<s.size(); j++)
            {
                if(s[j] == 'F' && ff)ff--;
                else if(s[j] == 'R' && rr)rr--;
                else if(s[j] == 'C' && cc)cc--;
                else{
                    dd = -1;
                    break;
                }
                dd++;
            }
            if(dd == -1) continue;
            string t = s;
            reverse(atoz(t));
            ans = max(ans,dd + fun(ff,rr,cc,t));
        }
    }
    else
    {
        lli ff = f - 3*d;
        lli cc = c - 2*d;
        lli rr = r - 2*d;
        lli now = d*7 + fun(ff,rr,cc,s);

        ans = max(ans, now);

        s = make();
        reverse(atoz(s));

        ff = f - 3*d;
        cc = c - 2*d;
        rr = r - 2*d;
        now = d*7 + fun(ff,rr,cc,s);
        ans = max(ans,now);

        d--;
        now = d*7;
        s = make();

        for(int i=0; i<s.size(); i++)
        {
            int dd = 0;
            ff = f - 3*d;
            cc = c - 2*d;
            rr = r - 2*d;
            for(int j=i; j<s.size(); j++)
            {
                if(s[j] == 'F' && ff)ff--;
                else if(s[j] == 'R' && rr)rr--;
                else if(s[j] == 'C' && cc)cc--;
                else{
                    dd = -1;
                    break;
                }
                dd++;
            }
            if(dd == -1) continue;
            string t = s;
            reverse(atoz(t));
            ans = max(ans,now + dd + fun(ff,rr,cc,t));
        }
    }

    cout<<ans;

    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)

#include<bits/stdc++.h>
using namespace std;

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define sz(v) v.size()
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define sqr(x) x*x
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ten(n) (int)1e##n
#define tenll(n) (lli)1e##n
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

///priority_queue< int, vector< int >, greater< int > > minHeap;

int fun(int ff, int rr, int cc, string s)
{
    int now = 0;
    while(s.size())
    {

        if(s.back()=='C' && cc) cc--;
        else if(s.back()=='F' && ff) ff--;
        else if(s.back()=='R' && rr)rr--;
        else break;

        s.pop_back();
        now++;
    }
    return now;
}

void mor()
{
    cout<<"NO";
    exit(0);
}

int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    ///FastIO;

    int f,r,c;
    scn3(f,r,c);

    int ans = 0;
    int d = min3(f/3,c/2, r/2);
    string s = "RFFRCFC";

    if(d==0)
    {

        for(int i=0; i<s.size(); i++)
        {
            int ff = f,rr = r, cc = c, dd = 0;
            for(int j=i; j<s.size(); j++)
            {

                if(s[j] == 'F' && ff)ff--;
                else if(s[j] == 'R' && rr)rr--;
                else if(s[j] == 'C' && cc)cc--;
                else break;
                dd++;
            }
            ans = max(ans,dd);
        }
    }
    else
    {
        int ff = f - 3*d;
        int cc = c - 2*d;
        int rr = r - 2*d;
        int now = d*7 + fun(ff,rr,cc,s);

        ans = max(ans, now);

        s = "RFFRCFC";
        reverse(atoz(s));

        ff = f - 3*d;
        cc = c - 2*d;
        rr = r - 2*d;
        now = d*7 + fun(ff,rr,cc,s);
        ans = max(ans,now);

        d--;

        ff = f - 3*d;
        cc = c - 2*d;
        rr = r - 2*d;
        now = d*7;
        s = "RFFRCFC";

        for(int i=0; i<s.size(); i++)
        {
            int dd = 0;
            for(int j=i; j<s.size(); j++)
            {
                if(s[j] == 'F' && ff)ff--;
                else if(s[j] == 'R' && rr)rr--;
                else if(s[j] == 'C' && cc)cc--;
                else break;
                dd++;
            }
            string t = s;
            reverse(atoz(t));
            ans = max(ans,now + dd + fun(ff,rr,cc,t));
        }
    }

    cout<<ans;

    return 0;
    ///return main();
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)

#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long
#define INF 0x3f3f3f3f
const int maxn = 101000;
const ll mod = 1e9 + 7;
int a, b, c, ans;
int main()
{
    scanf("%d %d %d", &a, &b, &c);
    int t = min((a/3, b/2), c/2);
    a -= t * 3; b -= t * 2; c -= t * 2;
    if(a >= 3) a = 3;
    if(b >= 2) b = 2;
    if(c >= 2) c = 2;
    if(a == 0) ans += t * 7;
    else{
        if(b == 0){
            if(a == 3) ans += 2;
            else ans += a;
        }
        else{
            if(c == 0){
                if(a == 3) ans += (2 + b + 7 * t);
                else ans += (a + b + 7 * t);
            }
            else{
                int k = min(min(a, b), c);
                ans += k * 3 + 7 * t;
                if(a-k > 0){
                    ans += a - k;
                    if(b - k > 0){
                        ans += a - k;
                        if(c - k > 0){
                            ans += a - k;
                        }
                    }
                }
            }
        }
    }
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fo(i,a,b) for(ll i=a;i<b;i++)
/*bool prime[1001];
#define len 1001
void init()
{
    memset(prime,true,sizeof(prime));
    for(int i=2;i<len;i++)
    {
        if(prime[i]) {
        int j=2;
        while(i*j<len)
        {
            prime[i*j]=false;
            j++;
        }
        }
    }
}*/
int main()
{
    io;
    ll a,b,c;
    cin>>a>>b>>c;
    ll w=1e9;
    w=min(w,a/3);
    w=min(w,b/2);
    w=min(w,c/2);
    a-=w*3;
    b-=w*2;
    c-=w*2;
    ll mx=0;
    for(ll i=1;i<=7;i++)
    {
        ll j=i;
        ll ans=0;
        while(1) {
        if(j%7==1 || j%7==4 || j%7==0)
        {
            if(a>0)
                a--;
            else
                break;
        }
        if(j%7==2 || j%7==6)
        {
            if(b>0)
                b--;
            else
                break;
        }
        if(j%7==3 || j%7==5)
        {
            if(c>0)
                c--;
            else
                break;
        }
        j++;
        ans++;
    }
    mx=max(mx,ans);
    }
    cout<<w*7+mx<<endl;
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
#include <memory>
#include <cstring>
#include <set>

using namespace std;

int main()
{
    const int weekdays[] = {0, 0, 1, 2, 0, 2, 1};
    int rations[3] = {0};
    cin >> rations[0] >> rations[1] >> rations[2];

    int startPoint = 0;
    int point = 0;
    int counter = 0;
    while(true)
    {
        if (rations[weekdays[point]] - 1 < 0)
        {
            if (weekdays[point] == weekdays[startPoint])
            {
                if(rations[0] == 0 && rations[1] == 0 && rations[2] == 0)
                {
                    break;
                }
                startPoint = startPoint + 1;
                if(startPoint == 7)
                {
                    break;
                }
                point = (point + 1) % 7;
                continue;
            }
            else
            {
                if (rations[weekdays[(startPoint + 6) % 7]] != 0)
                {
                    counter++;
                }
                break;
            }
        }
        else
        {
            if(rations[0] > 3 && rations[1] > 2 && rations[2] > 2)
            {
                rations[0] -= 3;
                rations[1] -= 2;
                rations[2] -= 2;
                continue;
            }
            rations[weekdays[point]]--;
            point = (point + 1) % 7;
            counter++;
        }
    }

    cout << counter << endl;

    return 0;
}

// [CF-C]GourmetCat.cpp : Defines the entry point for the console application.
//

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	long a, b, c;

	cin >> a >> b >> c;

	long a_w, b_w, c_w;
	a_w = a / 3;
	b_w = b / 2;
	c_w = c / 2;

	long max_weeks = min(c_w, min(a_w, b_w));

	long res_a = a - max_weeks * 3, res_b = b - max_weeks * 2, res_c = c - max_weeks * 2;
	long append;
	if (max_weeks == a_w) {
		if (res_b >= 2 && res_c >= 2 && res_a > 0)
			append = 4 + res_a;
		else
			append = min((long)1, res_b) + min((long)1, res_c) + min((long)2, res_a);
	}
	else {
		append = min((long)2, res_b) + min((long)1, res_c) + min((long)2, res_a);
	}
	cout << max_weeks * 7 + append;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c;
    int w = min(a / 3, min(b / 2, c / 2));
    a -= w * 3;
    b -= w * 2;
    c -= w * 2;
    int res = w * 7;
    for (int i = 0; i < 2; ++i) {
        if (a > 0) {
            res++, a--;
            if (b > 0) {
                res++, b--;
                if (c > 0) {
                    res++, c--;
                    if (a > 0) {
                        res++, a--;
                        if (c > 0) {
                            res++, c--;
                            if (b > 0)
                                res++, b--;
                        }
                    }
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define f(i,a,n) for(ll i=a;i<n;i++)
#define f1(i,a,n) for(ll i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll a,b,c;
    cin >> a >> b >> c;
    ll mn = min(a/3, min(b/2,c/2));
    ll ans = mn*7;
    a -= (mn * 3);
    b -= (mn * 2);
    c -= (mn *  2);
    if(a==0)
    {
       if(b>=1 && c>=1)
       ans +=2;
       else if(b>=1 || c>=1)
       ans +=1;
    }
    else if(a == 1)
    {
        if(b>=2 && c>=2)
         ans +=5;
        else if(b>=2)
       {
           if(c == 1)
           ans +=3;
           if(c == 0)
           ans += 2;
       }
       else if(c>=2)
       {
          if(b == 1)
           ans +=4;
           if(b == 0)
           ans += 1;
       }
       else
       {
           if(b == 0)
           ans +=1;
           else
           {
               if(c == 0)
               ans += 2;
               else
               ans += 3;

           }
       }
    }
    else if( a == 2)
    {
         if(b>=2 && c>=2)
         ans +=6;
        else if(b>=2)
       {
           if(c == 1)
           ans +=5;
           if(c == 0)
           ans += 2;
       }
       else if(c>=2)
       {
          if(b == 1)
           ans +=5;
           if(b == 0)
           ans += 1;
       }
       else
       {
           if(b == 0)
           ans +=1;
           else
           {
               if(c == 0)
               ans += 2;
               else
               ans += 4;

           }
       }
    }
    else
    {

        if(b>=2)
       {
           if(c == 1)
           ans +=6;
           if(c == 0)
           ans += 4;
       }
       else if(c>=2)
       {
          if(b == 1)
           ans +=6;
           if(b == 0)
           ans += 3;
       }
       else
       {
           if(b == 0)
           ans +=2;
           else
           {
               if(c == 0)
               ans += 3;
               else
               ans += 5;

           }
       }
    }
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int f,r,c;
int days[7];
int func(int index,int f, int r, int c)
{
    if(days[index]!=-1)return days[index];
    switch(index)
    {
    case 0:
        {
            if(f==0)
            {days[index]= 0;break;}
            days[0]=func((index+1)%7,f-1,r,c)+1;
            break;
        }
        case 1:
        {
            if(f==0){days[index]= 0;break;}
            days[1]=func((index+1)%7,f-1,r,c)+1;
            break;
        }
        case 2:
        {
            if(r==0){days[index]= 0;break;}
            days[2]=func((index+1)%7,f,r-1,c)+1;
            break;
        }
        case 3:
        {
            if(c==0){days[index]= 0;break;}
            days[3]=func((index+1)%7,f,r,c-1)+1;
            break;
        }
        case 4:
        {
            if(f==0){days[index]= 0;break;}
            days[4]=func((index+1)%7,f-1,r,c)+1;
            break;
        }
        case 5:
        {
            if(c==0){days[index]= 0;break;}
            days[5]=func((index+1)%7,f,r,c-1)+1;
            break;
        }
        case 6:
        {
            if(r==0){days[index]= 0;break;}
            days[6]=func((index+1)%7,f,r-1,c)+1;
            break;
        }

    }
    return days[index];
}
int main()
{
	 cin>>f>>r>>c;
	 int weeks=0;
	 for(int i=0;i<7;i++)days[i]=-1;
	 weeks=min(f/3,min(r/2,c/2));
	 if(weeks!=0)
	{
	    f=f%weeks;r=r%weeks;c=c%weeks;}
	 func(0,f,r,c);
	 int m=0;
	 for(int i=0;i<7;i++)
     {

         if(days[i]==-1)
         {
             func(i,f,r,c);
         }
         m=max(m,days[i]);
        // cout<<days[i]<<endl;
     }
	 cout<<m+weeks*7;

}

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define mk make_pair

void PLAY()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

/*ll vis[1000000];
ll len[1000000];
ll cnt=0;
vector<vector<ll>>x;

ll dfs(ll n)
{
    //cout<<n<<" a"<<endl;
    vis[n] = 1;
    for(int i=0;i<x[n].size();i++)
    {
        ll lol = x[n][i];
        if(!vis[lol])
        {
            dfs(lol);
            cnt++;
        }
    }

    return cnt;
}

void seth(ll a, ll b)
{
    if(vis[a]==2)
        return ;
    vis[a] = 2;
    len[a] = b;
    for(int i=0;i<x[a].size();i++)
    {
        ll lol = x[a][i];
        if(vis[lol]!=2)
        {
            seth(lol, b);
        }
    }
}*/

const int MOD = 1e9 + 7;
ll poww(ll b, ll p)
{
    if (p == 0)
        return 1;

    ll sq = poww(b, p / 2);

    sq = (sq * sq) % MOD;

    if (p % 2 == 1)
    {
        sq = (sq * b) % MOD;
    }

    return sq;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll a, b, c;
    cin >> a >> b >> c;
    ll ra = a / 3;
    ll rb = b / 2;
    ll rc = c / 2;
    ll mini = min(ra, min(rb, rc));
    ll ans = 0;
    a -= (mini * 3);
    b -= (mini * 2);
    c -= (mini * 2);
    ans += (mini * 7);

    //cout<<a<<" "<<b<<" "<<c<<endl;
    if(a==1 && c==1)
    {
        ans+=(1 + min(b, 1 * 1ll) + 1);
    }
    else if (a == 0)
    {
        ans += (min(b, 1 * 1ll) + min(c, 1 * 1ll));
    }
    else if (b == 0)
    {
        ans += max(2*1ll,(min(a, 1 * 1ll) + min(c, 2 * 1ll)));
    }
    else if (c == 0)
    {
        ans += (min(a, 2 * 1ll) + min(b, 1 * 1ll));
    }
    else
    {
        ans += (min(a, 3 * 1ll) + min(b, 2 * 1ll) + min(c, 2 * 1ll));
    }

    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
#define JN ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define mod 1000000007

#define pb push_back
#define mp make_pair

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;

int main ()
{
	JN;

	int a, b, c;

	cin >> a >> b >> c;

	ll days=0;

	ll ca = a/3;
	ll cb= b/2;
	ll cc = c/2;

	ll hell = min({ca, cb, cc})*7;
	days = days + min({ca, cb, cc}) * 7;
	a = a- min({ca, cb, cc})*3;
	b = b - min({ca, cb, cc})*2;
	c = c -  min({ca, cb, cc})*2;

	cout << a << " " << b << " " << c << endl;

	for(int i=0; i<7; i++)
	{
		ll dd[7]={0,1, 2, 0, 2, 1, 0};
		ll tmp[3] = {a,b,c};
		int more=0;

		for(int j=0; j<7; j++)
		{
			if(tmp[dd[(i+j)%7]] == 0)
				break;
			tmp[dd[(i+j)%7]]--;
			more++;

		}
		//if(i==6)
			//cout << i << " " << more << endl;
		days = max(days, hell+more);
	}

	cout << days << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define For(i,s,t) for (int i = (s); i <= (t); ++i)
#define rFor(i,t,s) for (int i = (t); i >= (s); --i)
#define foreach(i,c) for (__typeof(c.begin()) i = c.begin(); i != c.end(); ++i)
#define rforeach(i,c) for (__typeof(c.rbegin()) i = c.rbegin(); i != c.rend(); ++i)

#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl

#define LOWBIT(x) ((x)&(-x))

#define ALL(x) x.begin(),x.end()
#define INS(x) inserter(x,x.begin())

#define ms0(a) memset(a,0,sizeof(a))
#define msI(a) memset(a,inf,sizeof(a))
#define msM(a) memset(a,-1,sizeof(a))

#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second

inline int gc(){
	static const int BUF = 1e7;
	static char buf[BUF], *bg = buf + BUF, *ed = bg;

	if(bg == ed) fread(bg = buf, 1, BUF, stdin);
	return *bg++;
}

inline int ri(){
	int x = 0, f = 1, c = gc();
	for(; c<48||c>57; f = c=='-'?-1:f, c=gc());
	for(; c>47&&c<58; x = x*10 + c - 48, c=gc());
	return x*f;
}

typedef long long LL;
typedef unsigned long long uLL;
const double EPS = 1e-9;
const int inf = 1e9 + 9;
const LL mod = 1e9 + 7;
const int maxN = 1e5 + 7;
const LL ONE = 1;

struct Day{
	int x, y, z;

	Day(){}
	Day(int x, int y, int z) : x(x), y(y), z(z){}
};

int n, a, b, c, ans;
vector< Day > days[6] = {{Day(0, 0, 1), Day(0, 1, 0), Day(1, 0, 0)},
				{Day(2, 0, 0), Day(0, 1, 1), Day(1, 1, 0), Day(1, 0, 1)},
				{Day(2, 1, 0), Day(1, 1, 1), Day(1, 0, 2)},
				{Day(2, 2, 0), Day(2, 1, 1), Day(1, 1, 2)},
				{Day(2, 2, 1), Day(2, 1, 2), Day(1, 2, 2)},
				{Day(2, 2, 2)}};

int main(){
	cin >> a >> b >> c;
	int t = min(min(a / 3, b / 2), c / 2);

	ans += 7 * t;
	a -= 3 * t;
	b -= 2 * t;
	c -= 2 * t;

	rFor(i, 5, 0) {
		foreach(j, days[i]) {
			if(a >= j->x && b >= j->y && c >= j->z) {
				a -= j->x; b -= j->y; c -= j->z;
				ans += i + 1;
				i = 0;
				break;
			}

		}
	}

	cout << ans << endl;
	return 0;
}

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,min1=0,ea,eb,ec,ans;
    cin>>a>>b>>c;
    ea=a/3;
    eb=b/2;
    ec=c/2;
    min1=min(ea,min(eb,ec));
    ans=min1*7;
    a=a-3*min1;
    b=b-2*min1;
    c=c-2*min1;
    if(a==0)
        ans+=0;
    else if(a==1)
    {
        ans++;
        if(b>=c)
        {
            ans+=min(1,b);
            ans+=min(1,c);
        }
    }
    else if(a==2)
    {
        if(b==0)
        {
            ans+=2;
        }
        else if(b==1)
        {
            if(c==0)
                ans+=3;
            else if(c==1)
                ans+=4;
            else
                ans+=5;
        }
        else
        {
            if(c==0)
                ans+=4;
            else if(c==1)
                ans+=5;
            else
                ans+=6;
        }
    }
    else
    {
        if(b==0)
        {
            ans+=2;
        }
        else if(b==1)
        {
            if(c==0)
                ans+=3;
            else if(c==1)
                ans+=5;
            else
                ans+=6;
        }
        else
        {
            if(c==0)
                ans+=4;
            else
                ans+=6;
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	double flag=0,sum=0,fish,rabbit,chicken,m=0,num=0,flagf=0;
	cin >>fish>>rabbit>>chicken;
	double f,r,c;
	f=fish;
	r=rabbit;
	c=chicken;
	double a=min(fish,rabbit);
	a=min(a,chicken);
	if(fish==a)
	   flagf=1;
	//cout <<fixed<<setprecision(0)<<a<<" "<<fixed<<setprecision(0)<<f<<" "<<flagf;
	if(a>7)
	{
		m=a/7;//cout<<fixed<<setprecision(0)<<m<<" ";
		num=7*m;
	    f=fish-num;r=rabbit-num;c=chicken-num;
	}
	//cout <<fixed<<setprecision(0)<<f<<" "<<fixed<<setprecision(0)<<r<<" "<<fixed<<setprecision(0)<<c<<" ";
	for(double j=1;j<=7;j++)
	{
		fish=f;rabbit=r;chicken=c;//cout <<f<<r<<c<<endl;
		  for(double i=j;i<=7;i++)
		 {
			if(i==1||i==4||i==7)
			{
			  	if(fish==0)
			  	{
					if(sum<flag)
				  		sum=flag;
				  	flag=0;
				  	break;
				}
			  	fish--;
			  	flag++;//cout <<flag<<" ";
			}
			else if(i==2||i==6)
			{
			  	if(rabbit==0)
			  	{
					if(sum<flag)
				  	  sum=flag;
				  	flag=0;
				  	break;//700000000 200000000 300000000
			    }
			  	rabbit--;
			  	flag++;//cout <<flag<<" ";
			}
			else if(i==3||i==5)
			{
			  	if(chicken==0)
			  	{
					if(sum<flag)
				  	  sum=flag;
				  	flag=0;
				  	break;
			    }
			  	chicken--;
			  	flag++;//cout <<flag<<" ";
			}
			if(i==7&&fish>0)
			     i=0;
			else if(i==7&&fish==0)
			     flag=0;
		 }
    }
    if(flagf==1)
	{
		if(f==r&&f==c)
		   sum+=3;
		cout <<fixed<<setprecision(0)<<sum+num*7/3<<endl;

	 }
	else
	{
		if(f==r&&f==c)
		   sum+=3;
		cout <<fixed<<setprecision(0)<<sum+num*7/2<<endl;
	 }

	return 0;
}

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#define ll long long
#define N 500005
#define mod 1000000007
ll inf=1e18;
using namespace std;
int main()
{
    int a,b,c;
    int d=0;
    cin>>a>>b>>c;
    while(a>=3&&b>=2&&c>=2)
    {
        a-=3;
        b-=2;
        c-=2;
        d+=7;
    }
    if(a<=1)
    {
        if(a)
            d++;
        if(b)
            d++;
        if(c)
            d++;
    }
    else if(a==2)
    {
        if(b>=2)
        {
            d+=4;
            if(c<=1)
                d+=c;
            else
                d+=2;
        }
        if(b==1)
        {
            if(c>=2)
                d+=5;
            else
                d=d+3+c;
        }
        if(b==0)
        {
            if(c>=2)
                d+=3;
            else
                d+=2;
        }
    }
    else if(b==1)
    {
        if(c==0)
            d+=3;
        if(c==1)
            d+=5;
        if(c>=2)
            d+=6;
    }
    else if(b==0)
    {
        if(c>=2)
            d+=3;
        else d+=2;
    }

    else if(c==0)
        d+=4;
    else if(c==1)
        d+=6;
    cout<<d<<endl;
    return 0;
}