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.

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<stdio.h>
#include<stdlib.h>
int min(int x,int y,int z)
{
	if(x<=y && x<=z)
		return x;
	else if(y<=x && y<=z)
		return y;
	else if(z<=x && z<=y)
		return z;
}
/*int max(int x,int y,int z)
{
	if(x>=y && x>=z)
		return x;
	else if(y>=z && y>=x)
		return y;
	else if(z>=x && z>=y)
		return z;
}*/
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	int x = a/3;
	int y = b/2;
	int z = c/2;
	int k = min(x,y,z);
	int a1 = a - 3*k;
	int b1 = b - 2*k;
	int c1 = c - 2*k;
	long long int d1 = 7*k;
	int m =0;
	int arr[7] = {0,1,2,0,2,1,0};
	for(int i = 0;i<7;i++)
	{	int max = 0;
		int temp[3];
		temp[0]=a1;temp[1]=b1;temp[2]=c1;
		for(int j =i;j<(i+7);j++)
		{
			if(temp[arr[j%7]]==0)
				break;
			temp[arr[j%7]]--;
			max++;
		}
	//	printf("max = %d\n",max);
		if(m<max)
			m = max;
	}
	d1 = d1+m;
	printf("%lld\n",d1);
	return 0;
}

#include<stdio.h>
#include<math.h>
int main(){
	long long ans[10]={0},max,flag,count[4]={0},a,b,c,i,st,a1,a2,a3;
	scanf("%lld%lld%lld",&a,&b,&c);
	count[1]=a;
	count[2]=b;
	count[3]=c;
        for(i=1;i<=7;i++)
	{

		flag=i;
		count[1]=a;
		count[2]=b;
		count[3]=c;
		if(count[1]>=3 && count[2]>=2 && count[3]>=2)
		{
			a1=count[1]/3;
			a2=count[2]/2;
			a3=count[3]/2;
			st=fmin(a1,fmin(a2,a3));
			count[1]-=st*3;
			count[2]-=st*2;
			count[3]-=st*2;
			ans[i]+=st*7;
		}

		while(1)
		{
			//start monday
			if(flag==1)
			{
				if(count[1]==0)
					break;
				count[1]--;
				ans[i]++;
				flag=2;
			}
			if(flag==2)
			{
				if(count[2]==0)
					break;
				count[2]--;
				ans[i]++;
				flag=3;
			}
			 if(flag==3)
                        {
                                if(count[3]==0)
                                        break;
                                count[3]--;
                                ans[i]++;
                                flag=4;
                        }
			  if(flag==4)
                        {
                                if(count[1]==0)
                                        break;
                                count[1]--;
                                ans[i]++;
                                flag=5;
                        }
			   if(flag==5)
                        {
                                if(count[3]==0)
                                        break;
                                count[3]--;
                                ans[i]++;
                                flag=6;
                        }
			    if(flag==6)
                        {
                                if(count[2]==0)
                                        break;
                                count[2]--;
                                ans[i]++;
                                flag=7;
                        }
			     if(flag==7)
                        {

                                if(count[1]==0)
                                        break;
                                count[1]--;
                                ans[i]++;
				flag=1;
                        }
		}
	}

	max=0;
	for(i=1;i<=7;i++)
	{
	//	printf("%lld\n",ans[i]);
		if(ans[i]>=max)
			max=ans[i];
	}
	printf("%lld\n",max);
	return 0;
}

#include <stdio.h>

int main(){
    int a, b, c, sum = 0, r = 0;
    scanf("%d %d %d", &a, &b, &c);
    while(a >= 3 && b >= 2 && c >= 2){
        a -= 3;
        b -= 2;
        c -= 2;
        sum += 7;
    }
    int next, e, ccc, ee, aa, bb, cc;
    for(int i = 0; i < 7; i++){
        next = 1; e = i; ccc = 0; aa = a; bb = b; cc = c;
        while(next){
            ee = e%7;
            if(ee == 0 || ee == 3 || ee == 6){
                if(aa == 0){
                    next = 0;
                } else {
                    aa--;
                }
            } else if(ee == 1 || ee == 5){
                if(bb == 0){
                    next = 0;
                } else {
                    bb--;
                }
            } else {
                if(cc == 0){
                    next = 0;
                } else {
                    cc--;
                }
            }
            if(next){
                ccc++;
                e++;
            }
        }
        if(ccc > r){
            r = ccc;
        }
    }
    printf("%d", sum+r);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef long long int LL;

int min(int a, int b){
	if( a <= b ) return a;
	return b;
}

int main(){
	// 1, 4, 7: fish
	// 2, 6: 	rabbit
	// 3, 5: 	chicken

	int f, r, c;
	scanf("%d%d%d", &f, &r, &c);

	int base = min(min(f/3, r/2), c/2);	/*base weeks*/

	f -= 3 * base;
	r -= 2 * base;
	c -= 2 * base;

	LL day = (LL)base * 7;
	LL max = day;

	LL tmp;

	int ff = f, rr = r, cc = c;

	for(int i = 1; i <= 7; ++i){
		// start at day i
		tmp = day;
		ff = f; rr = r; cc = c;
		for(int j = 0, done = 0; !done; ++j){
			switch( (i+j) % 7 ){
				case 1: case 4: case 0:	/* fish */
					if(ff > 0){
						ff--;
						tmp++;
					}else{
						done = 1;
					}
					break;
				case 2: case 6:			/* rabbit */
					if(rr > 0){
						rr--;
						tmp++;
					}else{
						done = 1;
					}
					break;
				default:				/* chicken */
					if(cc > 0){
						cc--;
						tmp++;
					}else{
						done = 1;
					}
					break;
			}
		}
		if(tmp > max) max = tmp;
//		printf("i = %d, count = %I64d\n", i, tmp);
	}

	printf("%I64d\n", max);

	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

typedef unsigned long long opo;

#define S scanf
#define P printf
#define M malloc
#define SI sizeof

int cmp(const void *a, const void *b)
{
	int *c;
	int *d;
	c = (int*)a;
	d = (int*)b;
	if (*c > *d)
		return (1);
	if (*c == *d)
		return (0);
	return (-1);
}

int main()
{
	int a,b,c;
	S("%d %d %d", &a, &b, &c);
	int out = 0;
	int min = a / 3;
	min = b / 2 < min ? b / 2 : min;
	min = c / 2 < min ? c / 2 : min;
	out += min * 7;
	int arr[7];
	int x = 0;
	while (x < 7)
	{
		int ta,tb,tc;
		ta = a - min * 3;
		tb = b - min * 2;
		tc = c - min * 2;
		int count = 0;
		while (1)
		{
			if ((x + count) % 7 == 0 || (x + count) % 7 == 3 || (x + count) % 7 == 6 )
			{
				if (ta == 0)
					break;
				ta--;
			}
			else if ((x + count) % 7 == 1 || (x + count) % 7 == 5)
			{
				if (tb == 0)
					break;
				tb--;
			}
			else if ((x + count) % 7 == 2 || (x + count) % 7 == 4)
			{
				if (tc == 0)
					break;
				tc--;
			}
			count++;
		}
		arr[x] = count;
		x++;
	}
	qsort(arr, 7, SI(int), cmp);
	P("%d", out + arr[6]);
}

/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:18/04/2019
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
int cmp(const void * a,const void * b)
{
    return (*(int*)a - *(int*)b);
}
int main()
{
    long long t=1;
    //scanf("%lld",&t);
    while(t--)
    {
        long long a,b,c,min;
        scanf("%lld%lld%lld",&a,&b,&c);
        long long a1=a/3,b1=b/2,c1=c/2;
        if(a1<=b1 && a1<=c1)
            min=a1;
        else if(b1<=a1 && b1<=c1)
            min=b1;
        else
            min=c1;

        a-=min*3;
        b-=min*2;
        c-=min*2;
        long long arr[3]={a,b,c};
        int idx[]={0,1,2,0,2,1,0};
        int b2[7];
        long long ans=0,f=0;
        for(int i=0;i<7;i++)
        {
            int day=i;
            int cur=0;
            b2[0]=arr[0],b2[1]=arr[1],b2[2]=arr[2];
            while(b2[idx[day]]>0)
            {
                --b2[idx[day]];
			    day = (day + 1) % 7;
			    ++cur;
            }
            if(min*7+cur>ans)
                ans=min*7+cur;
            else
                ans=ans;
        }

        printf("%lld\n",ans);
    }
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int compare_char(char *a,char *b){
	return strcmp(a,b);
}

int intsort(const void *a, const void *b){
	return *(int*)b - *(int*)a;
	/*qsort(a,aの配列数,sizeof(int),intsort);*/
}

int longsort(const void *a, const void *b){
	long *A=(long *)a;
	long *B=(long *)b;
	if(*A>*B) return -1;
	if(*A<*B) return 1;
	return 0;
}

int main(){
	int i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;
	for(i=0;i<3;i++){
	scanf("%d",&a[i]);
	}
/*	if(a[0]%3==0){
*/

b[0]=a[0]/3;
min=b[0];
/*	}else{
		b[0]=a[0]/3+1;
	}
	if(a[1]%2==0){
*/
b[1]=a[1]/2;
if(min>b[1])min=b[1];
/*	}else{
		b[1]=a[1]/2+1;
	}
	if(a[2]%2==0){
*/
b[2]=a[2]/2;
if(min>b[2])min=b[2];
/*	}else{
		b[2]=a[2]/2+1;
	}
*/

ans=min*7;
a[0]-=3*min;
a[1]-=2*min;
a[2]-=2*min;
min=0;
x=a[0];
y=a[1];
z=a[2];
	//sun
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	}
	min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
				//月
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//火曜
	while(1){
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//水曜
	while(1){
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//木曜
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//金曜
	while(1){
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];

			//土曜
	while(1){
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

printf("%d\n",ans+min);
	return 0;
}

#include <stdio.h>
#include <string.h>

const char str[14]={'f','f','r','c','f','c','r','f','f','r','c','f','c','r'};

int findMax(int f, int r, int c);
int find(int start, int f, int r, int c);

int main(void)
{
    int f,r,c,d=0;
    scanf("%d %d %d", &f, &r, &c);

    for(;;)
    {
        if(f>=3 && r>=2 && c>=2)
        {
            f-=3;
            r-=2;
            c-=2;
            d+=7;
        }
        else
        {
            break;
        }
    }

    printf("%d", d+findMax(f, r, c));

    return 0;
}

int findMax(int f, int r, int c)
{
    int i, max=0;

    for(i=0; i<7; i++)
    {
        if(max<find(i, f, r, c))
        {
            max=find(i, f, r, c);
        }
    }
    return max;
}

int find(int start, int f, int r, int c)
{
    int i, day=0;

    for(i=0;;i++)
    {
        if(f>0 && str[start+i]=='f')
        {
            day++;
            f-=1;
        }
        else if(r>0 && str[start+i]=='r')
        {
            day++;
            r-=1;
        }
        else if(c>0 && str[start+i]=='c')
        {
            day++;
            c-=1;
        }
        else
        {
            break;
        }
    }

    return day;
}

#include<stdio.h>
#define MIN(a,b) (a<b)?a:b
#define MAX(a,b) (a>b)?a:b;

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

int SUR = 0;
int maksus;
int AHAN[3];

int main(){
    scanf("%d %d %d",&AHAN[0],&AHAN[1],&AHAN[2]);
    int d=(MIN(AHAN[0]/3,(MIN(AHAN[1]/2,AHAN[2]/2))));
    AHAN[0]-=d*3;AHAN[1]-=d*2;AHAN[2]-=d*2;
    SUR += d*7;

    for(int i=0;i<7;i++){
        int Tod[3];for(int i=0;i<3;i++)Tod[i]=AHAN[i];
        int tn=0;
        for(int j=0;j<6;j++){
            if(Tod[CAT[(i+j)%7]]!=0){
                Tod[CAT[(i+j)%7]]--;
                tn++;
            }
            else{
              goto job;
            }
        }
        job:;
        maksus = MAX(maksus,tn);
    }
      printf("%d",SUR+maksus);
}

/* https://codeforces.com/contest/1154/submission/53710754 (rainboy) */
#include <stdio.h>

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

int min(int a, int b) {
	return a < b ? a : b;
}

int main() {
	int a, b, c, x, i, j, max;

	scanf("%d%d%d", &a, &b, &c);
	x = min(a / 3, min(b / 2, c / 2));
	a -= x * 3;
	b -= x * 2;
	c -= x * 2;
	max = 0;
	for (i = 0; i < 7; i++) {
		int a_ = a, b_ = b, c_ = c;

		for (j = i; j < 14; j++)
			if (aa[j] == 0) {
				if (a_-- == 0)
					break;
			} else if (aa[j] == 1) {
				if (b_-- == 0)
					break;
			} else
				if (c_-- == 0)
					break;
		if (max < j - i)
			max = j - i;
	}
	printf("%d\n", x * 7 + max);
	return 0;
}

#include <stdio.h>

int main(void){
	int arr[7]={0,};
	int i, j, A, B, C, a, b, c, weekday, cnt, max=0;

	scanf("%d %d %d", &A, &B, &C);

	for(i=0; i<7; i++){
		a=A;
		b=B;
		c=C;
		cnt=0;
		weekday=i;

		max=A/3;
		if(max>B/2){
			max=B/2;
		}
		if(max>C/2){
			max=C/2;
		}

		a-=max*3;
		b-=max*2;
		c-=max*2;
		cnt+=max*7;

		while(a!=-1 && b!=-1 && c!=-1){
			if(weekday%7==1 || weekday%7==4 || weekday%7==0){
				a--;
			}
			else if(weekday%7==2 || weekday%7==6){
				b--;
			}
			else{
				c--;
			}
			weekday++;
			cnt++;
		}
		arr[i]=cnt;
	}

	for(i=0; i<7; i++){
		if(max<arr[i]){
			max=arr[i];
		}
	}

	printf("%d", max-1);

	return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(){

	int a,b,c;
	int week[8],sum = 0,i,max = -1,x,ans = 0;

	scanf("%d%d%d",&a,&b,&c);
	while (a>=3 && b>=2 && c>=2){
		a-=3;
		b-=2;
		c-=2;
		sum+=7;
	}
	for (i=0;i<7;i++){
		week[0] = a;
		week[1] = b;
		week[2] = c;
		week[3] = a;
		week[4] = c;
		week[5] = b;
		week[6] = a;
		x = i;
		ans = 0;
		while (week[x]){
			switch(x){
				case 0 : week[0]--; week[3]--; week[6]--; break;
				case 1 : week[1]--; week[5]--; break;
				case 2 : week[2]--; week[4]--; break;
				case 3 : week[0]--; week[3]--; week[6]--; break;
				case 4 : week[2]--; week[4]--; break;
				case 5 : week[1]--; week[5]--; break;
				case 6 : week[0]--; week[3]--; week[6]--; break;
			}
			ans++;
			x = (x + 1)%7;
		}
		if (max < ans) max = ans;
	}
	printf("%d",max+sum);
	return 0;
}

#include <stdio.h>
typedef long long int ll;
ll min(ll a, ll b, ll c)
{
    if (a <= b && a <= c)
    {
        return a;
    }
    else if (b <= a && b <= c)
    {
        return b;
    }
    else
        return c;
}
int main()
{
    int arr[7] = {0, 1, 2, 0, 2, 1, 0};
    ll f, r, c;
    ll days = 0;
    scanf("%lld %lld %lld", &f, &r, &c);

    ll x = min(f / 3, (r) / 2, (c) / 2);
    days = x * 7;
    f -= 3 * x;
    r -= 2 * x;
    c -= 2 * x;

    // while (f >= 2 && r >= 2 && f >= 3)
    // {
    //     days += 7;
    //     r -= 2;
    //     f -= 3;
    //     c -= 2;
    // }
    ll max = 0;
    for (int i = 0; i < 7; i++)
    {

        ll p[3] = {f, r, c};
        ll j = i;
        ll d = 0;
        while (p[arr[j]] > 0)
        {
            p[arr[j]]--;
            d++;
            j++;
            if (j == 7)
            {
                j = 0;
            }
        }
        //printf("%lld\n", d);
        if (max < d)
        {
            max = d;
        }
    }
    days += max;
    printf("%lld", days);
}

#include <stdio.h>

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

    long long p = a, q = b, r = c;
    p = p / 3;
    q = q / 2;
    r = r / 2;

    long long min = p;
    if (q < min)
    {
        min = q;
    }
    if (r < min)
    {
        min = r;
    }
    p = a;
    q = b;
    r = c;

    long long int count = 1;
    long long int max = -1;

    for (long long int i = 1; i <= 7; i++)
    {
        count = i;

        a = p - min * 3;
        b = q - min * 2;
        c = r - min * 2;
        //printf("STARTING DY OF WEEK IS %lld\n", i);

        while (a >= 0 && b >= 0 && c >= 0)
        {

            if (count % 7 == 1)
            {
                a--;
            }
            if (count % 7 == 2)
            {
                a--;
            }
            if (count % 7 == 3)
            {
                b--;
            }
            if (count % 7 == 4)
            {
                c--;
            }
            if (count % 7 == 5)
            {
                a--;
            }
            if (count % 7 == 6)
            {
                c--;
            }
            if (count % 7 == 0)
            {
                b--;
            }

            count++;
        }

        count -= i + 1;

        if (max < count)
        {
            max = count;
        }
    }

    max = max + 7 * min;
    printf("%lld", max);

    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int cmpfun(const void * a, const void * b)
{
   return ( *(int*)a - *(int*)b );
}
int main()
{
    int a,ac,b,bc,cc,c,n,i,days=0,day,j,d[3];
    scanf("%d %d %d",&a,&b,&c);
    d[0]=a/3;
    d[1]=b/2;
    d[2]=c/2;
    qsort(d,3,sizeof(int),cmpfun);

    day=d[0]*7;
    a-=(d[0]*3);
    b-=(d[0]*2);
    c-=(d[0]*2);

    for(j=1;j<8;j++)
    {
        n=0;
        ac=a;
        bc=b;
        cc=c;
        i=j;
        while(1)
        {

            if(i==1||i==4||i==7)
            {
                if(ac==0)break;
                ac--;
            }
            else if(i==2||i==6)
            {
                if(bc==0)break;
                bc--;
            }
            else
            {
                if(cc==0)break;
                cc--;
            }
            if(i==7)i=1;
            else i++;
            n++;
            //printf("%d %d %d\n",ac,bc,cc);
        }
        if(days<n)days=n;
    }
    printf("%d",days+day);
}

#include<stdio.h>

int min(int a, int b, int c)
{
	int	min = a;
	if(b<min)
		min = b;
	if(c<min)
		min = c;
	return min;
}

int main()
{
	//F R C F C R F
	int a, b, c, mini, max, set, a1, a2, a3;
	int arr[7];

	scanf("%d %d %d", &a, &b, &c);

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

	//printf("%d and %d and %d and %d\n", mini, a, b, c);

	for(int j =0; j<7; j++)
	{
		a1= a;
		a2 = b;
		a3 = c;
		for(int i = 0; i<7; i++)
		{
			if((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)
				{
					if(a1 == 0){
						set = i;
						break;
					}
					else{
						a1--;
						//printf("a %d\n", i);
					}
				}
			if((i+j)%7 == 1 || (i+j)%7 == 5)
				{
					if(a2 == 0){
						set = i;
						break;
					}
					else{
						a2--;
						//printf("b %d\n", i);
					}
				}
			if((i+j)%7 == 2 || (i+j)%7 == 4)
				{
					if(a3 == 0){
						set = i;
						break;
					}
					else{
						a3--;
						//printf("c %d\n", i);
					}
				}
		}
		if(j == 0)
			max = set;
		else
		{
			if(set>max)
				max = set;
		}
		//printf("max in run %d is %d\n", j, max);

	}

	printf("%d\n", max + 7*mini);
	return 0;
}

#include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)>(b)?(b):(a))
int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    int na = a / 3, nb = b / 2, nc = c / 2;
    int ans = min(na, min(nb, nc));
    na = min(3, a-ans*3), nb = min(2, b-ans*2), nc = min(2, c-ans*2);
    ans *= 7;
    const char s[] = {'a', 'b', 'c', 'a', 'c', 'b', 'a'};
    int maxv = 0;
    for(int i = 0; i < 7; i++)
    {
        int j = i, value = 0;
        int tmpa = na, tmpb = nb, tmpc = nc;
        while(tmpa > 0 || tmpb > 0 || tmpc > 0)
        {
            if(s[j] == 'a')
            {
                if(tmpa <= 0) break;
                tmpa--;
            }
            else if(s[j] == 'b')
            {
                if(tmpb <= 0) break;
                tmpb--;
            }
            else
            {
                if(tmpc <= 0) break;
                tmpc--;
            }
            j = (j+1)%7;
            value++;
        }
        maxv = max(maxv, value);
    }
    printf("%d\n", ans+maxv);
}

#include<stdio.h>
#include<string.h>

int main(){

    long long  totald,min,a,b,c,ca,cb,cc;
    scanf("%lld%lld%lld",&a,&b,&c);
    ca=a/3;a=a%3;
    cb=b/2;b=b%2;
    cc=c/2;c=c%2;
    min=ca<cb?(ca<cc?ca:cc):(cb<cc?cb:cc);
    ca-=min;
    cb-=min;
    cc-=min;
    totald=min*7;
    a+=ca*3;
    b+=cb*2;
    c+=cc*2;

     //printf("%lld %lld %lld %lld\n",a,b,c,totald);

    long long count,max=-1,tmpa,tmpb,tmpc,arr[14];
    for(int i=0;i<14; i++){
        tmpa=a;
        tmpb=b;
        tmpc=c;
        memset(arr,0,sizeof(arr));
        for(int j=i;j<14; j++){
            if((j%7==0 || j%7==3) && tmpb){
                arr[j]=1;
                tmpb--;
            }
            else if((j%7==1 || j%7==2 || j%7== 5 )&& tmpa){
                arr[j]=2;
                tmpa--;
            }
            else if((j%7==4 || j%7==6 )&& tmpc){
                arr[j]=3;
                tmpc--;
            }
        }
        count=0;
        for(int k=i;k<14; k++){
            if(arr[k]==0)break;
          //printf("%d ",arr[k] );
            count++;
        }
      //puts("");
        if(count>max){
            max=count;
        }
    }
    printf("%lld\n",totald+max);
    return 0;
}

#include<stdio.h>
int chi(int n,int a,int b,int c)
{
	int count = 0;
	while(1)
	{
		int yu = n % 7;
		if(yu == 1 || yu == 4 || yu == 0)
		{
			a--;
			if(a >= 0)
				count++;
			else
				return count;
		}
		if(yu == 2 || yu == 6)
		{
			b--;
			if(b >= 0)
				count++;
			else
				return count;
		}
		if(yu == 3 || yu == 5)
		{
			c--;
			if(c >= 0)
				count++;
			else
				return count;
		}
		n++;
	}
}
int main()
{
	int a,b,c;
	while(scanf("%d %d %d",&a,&b,&c) != EOF)
	{
		int day = 0;
		int week;
		int m = a / 3;
		int n = b / 2;
		int o = c / 2;
		week = m;
		if(week > n)
			week = n;
		if(week > o)
			week = o;
		day = week * 7;
		a = a - week * 3;
		b = b - week * 2;
		c = c - week * 2;
		int max = 0;
		for(int i=0;i<7;i++)
		{
			int temp = chi(i,a,b,c);
			if(max < temp)
				max = temp;
		}
		day += max;
		printf("%d\n",day);
	}
}

#include<stdio.h>
int menu[8]={1,2,3,1,3,2,1};
int lastweek(int f,int r,int c,int offset)
{
	int i,daysfed=0;
	for(i=offset;i<offset+10;i++)
	{
		switch(menu[i%7]-1)
		{
			case 0:
			case 3:
			case 6:
				if(f==0)
					return daysfed;
				f--;
				daysfed++;
				break;
			case 1:
			case 5:
				if(r==0)
					return daysfed;
				r--;
				daysfed++;
				break;
			case 2:
			case 4:
				if(c==0)
					return daysfed;
				c--;
				daysfed++;
				break;
		}
	}
	return daysfed;
}
int main()
{
	int f,r,c,min_weeks,max_days;
	scanf("%d%d%d",&f,&r,&c);
	min_weeks=f/3;
	if(min_weeks>r/2)min_weeks=r/2;
	if(min_weeks>c/2)min_weeks=c/2;
	f-=3*min_weeks;
	r-=2*min_weeks;
	c-=2*min_weeks;
	max_days=min_weeks*7;
	int Max=0,i,val;
	for(i=0;i<7;i++)
	{
		val=lastweek(f,r,c,i);
		if(Max<val)
			Max=val;
	}
	printf("%d\n",Max+max_days);
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
if(a>3 || b>2 || c>2)
{

mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
}

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(a>0)
    {

        if(b==0 || c==0)
        {

        if(b==0)
            nr=nr+3;
        if(c==0)
            nr=nr+2;

        }

    if(b!=0 && c!=0 )
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    }
    else
        if(a==0 && c>0 && b>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+c+1;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int min(int a, int b){
	if( a <= b ) return a;
	return b;
}

int main(){
	// 1, 4, 7: fish
	// 2, 6: 	rabbit
	// 3, 5: 	chicken

	int f, r, c;
	scanf("%d%d%d", &f, &r, &c);

	int base = min(min(f/3, r/2), c/2);	/*base weeks*/

	f -= 3 * base;
	r -= 2 * base;
	c -= 2 * base;

	int day = base * 7;
	int max = day;

	int tmp;

	for(int i = 1; i <= 7; ++i){
		// start at day i
		tmp = day;
		for(int j = 0, done = 0; !done; ++j){
			switch( (i+j) % 7 ){
				case 1: case 4: case 0:	/* fish */
					if(f > 0){
						f--;
						tmp++;
					}else{
						done = 1;
					}
					break;
				case 2: case 6:			/* rabbit */
					if(r > 0){
						r--;
						tmp++;
					}else{
						done = 1;
					}
					break;
				default:				/* chicken */
					if(c > 0){
						c--;
						tmp++;
					}else{
						done = 1;
					}
					break;
			}
		}
		if(tmp > max) max = tmp;
	//	printf("i = %d, count = %d\n", i, tmp);
	}

	printf("%d\n", max);

	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int compare_char(char *a,char *b){
	return strcmp(a,b);
}

int intsort(const void *a, const void *b){
	return *(int*)b - *(int*)a;
	/*qsort(a,aの配列数,sizeof(int),intsort);*/
}

int longsort(const void *a, const void *b){
	long *A=(long *)a;
	long *B=(long *)b;
	if(*A>*B) return -1;
	if(*A<*B) return 1;
	return 0;
}

int main(){
	int i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;
	for(i=0;i<3;i++){
	scanf("%d",&a[i]);
	}
/*	if(a[0]%3==0){
*/

b[0]=a[0]/3;
min=b[0];
/*	}else{
		b[0]=a[0]/3+1;
	}
	if(a[1]%2==0){
*/
b[1]=a[1]/2;
if(min>b[1])min=b[1];
/*	}else{
		b[1]=a[1]/2+1;
	}
	if(a[2]%2==0){
*/
b[2]=a[2]/2;
if(min>b[2])min=b[2];
/*	}else{
		b[2]=a[2]/2+1;
	}
*/
ans=min*7;
a[0]-=7*min;
a[1]-=7*min;
a[2]-=7*min;
min=0;
x=a[0];
y=a[1];
z=a[2];
//sun
while(1){
if(x>0){
x--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
}
min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];
//月
while(1){
if(x>0){
x--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
}
if(min<day)min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];
//月
while(1){
if(y>0){
y--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
}
if(min<day)min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];
//月
while(1){
if(z>0){
z--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
}
if(min<day)min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];
//月
while(1){
if(x>0){
x--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
}
if(min<day)min=day;

day=0;
x=a[0];
y=a[1];
z=a[2];
//月
while(1){
if(z>0){
z--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
if(y>0){
y--;
day++;
}else{
break;
}
if(z>0){
z--;
day++;
}else{
break;
}
if(x>0){
x--;
day++;
}else{
break;
}
}
if(min<day)min=day;

printf("%d\n",ans+min);
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int compare_char(char *a,char *b){
	return strcmp(a,b);
}

int intsort(const void *a, const void *b){
	return *(int*)b - *(int*)a;
	/*qsort(a,aの配列数,sizeof(int),intsort);*/
}

int longsort(const void *a, const void *b){
	long *A=(long *)a;
	long *B=(long *)b;
	if(*A>*B) return -1;
	if(*A<*B) return 1;
	return 0;
}

int main(){
	int i,N,j,p,a[4]={0},b[i],cnt=0,min,ans=0,x,y,z,day=0;
	for(i=0;i<3;i++){
	scanf("%d",&a[i]);
	}
/*	if(a[0]%3==0){
*/

b[0]=a[0]/3;
min=b[0];
/*	}else{
		b[0]=a[0]/3+1;
	}
	if(a[1]%2==0){
*/
b[1]=a[1]/2;
if(min>b[1])min=b[1];
/*	}else{
		b[1]=a[1]/2+1;
	}
	if(a[2]%2==0){
*/
b[2]=a[2]/2;
if(min>b[2])min=b[2];
/*	}else{
		b[2]=a[2]/2+1;
	}
*/

ans=min*7;
a[0]-=3*min;
a[1]-=2*min;
a[2]-=2*min;
min=0;
x=a[0];
y=a[1];
z=a[2];
	//sun
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	}
	min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
				//月
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//火曜
	while(1){
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//水曜
	while(1){
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//木曜
	while(1){
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

	day=0;
	x=a[0];
	y=a[1];
	z=a[2];
			//金曜
	while(1){
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;
			//土曜
	while(1){
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(y>0){
	y--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	if(x>0){
	x--;
	day++;
	}else{
	break;
	}
	if(z>0){
	z--;
	day++;
	}else{
	break;
	}
	}
	if(min<day)min=day;

printf("%d\n",ans+min);
	return 0;
}

#include <stdio.h>

int main(void){
	int arr[7]={0,};
	int i, A, B, C, a, b, c, weekday, cnt, max=0;

	scanf("%d %d %d", &A, &B, &C);

	for(i=0; i<7; i++){
		a=A;
		b=B;
		c=C;
		cnt=0;
		weekday=i;
		while(a!=-1 && b!=-1 && c!=-1){
			if(weekday%7==1 || weekday%7==4 || weekday%7==0){
				a--;
			}
			else if(weekday%7==2 || weekday%7==6){
				b--;
			}
			else{
				c--;
			}
			weekday++;
			cnt++;
		}
		arr[i]=cnt;
	}

	printf("a: %d / b: %d / c: %d\n", a, b, c);
	for(i=0; i<7; i++){
		printf("%d ", arr[i]);
		if(max<arr[i]){
			max=arr[i];
		}
	}
	printf("\n");

	printf("%d", max-1);

	return 0;
}

#include<stdio.h>

int min(int a, int b, int c)
{
	int	min = a;
	if(b<min)
		min = b;
	if(c<min)
		min = c;
	return min;
}

int main()
{
	//F R C F C R F
	int a, b, c, mini, max, set, a1, a2, a3;
	int arr[7];

	scanf("%d %d %d", &a, &b, &c);

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

	printf("%d and %d and %d and %d\n", mini, a, b, c);

	for(int j =0; j<7; j++)
	{
		a1= a;
		a2 = b;
		a3 = c;
		for(int i = 0; i<7; i++)
		{
			if((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)
				{
					if(a1 == 0){
						set = i;
						break;
					}
					else{
						a1--;
						printf("a %d\n", i);
					}
				}
			if((i+j)%7 == 1 || (i+j)%7 == 5)
				{
					if(a2 == 0){
						set = i;
						break;
					}
					else{
						a2--;
						printf("b %d\n", i);
					}
				}
			if((i+j)%7 == 2 || (i+j)%7 == 4)
				{
					if(a3 == 0){
						set = i;
						break;
					}
					else{
						a3--;
						printf("c %d\n", i);
					}
				}
		}
		if(j == 0)
			max = set;
		else
		{
			if(set>max)
				max = set;
		}
		printf("max in run %d is %d\n", j, max);

	}

	printf("%d\n", max + 7*mini);
	return 0;
}

#include<stdio.h>

int min(int a, int b, int c)
{
	int	min = a;
	if(b<min)
		min = b;
	if(c<min)
		min = c;
	return min;
}

int main()
{
	//F R C F C R F
	int a, b, c, mini, max, set;
	int arr[7];

	scanf("%d %d %d", &a, &b, &c);

	mini = min(a/3, b/2, c/2);
	a = a - mini*3;
	b = b - mini*2;
	c = c - mini*2;
	printf("%d and %d and %d and %d\n", mini, a, b, c);

	for(int j =0; j<7; j++)
	{
		for(int i = 0; i<7; i++)
		{
			if((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)
				{
					if(a == 0){
						set = i;
						break;
					}
					else{
						a--;
						//printf("a %d\n", i);
					}
				}
			if((i+j)%7 == 1 || (i+j)%7 == 5)
				{
					if(b == 0){
						set = i;
						break;
					}
					else{
						b--;
						//printf("b %d\n", i);
					}
				}
			if((i+j)%7 == 2 || (i+j)%7 == 4)
				{
					if(c == 0){
						set = i;
						break;
					}
					else{
						c--;
						//printf("c %d\n", i);
					}
				}
		}
		if(j == 0)
			max = set;
		else
		{
			if(set>max)
				max = set;
		}
		//printf("max in run %d is %d\n", j, max);

	}

	printf("%d\n", max + 7*mini);
	return 0;
}

#include<stdio.h>

int min(int a, int b, int c)
{
	int	min = a;
	if(b<min)
		min = b;
	if(c<min)
		min = c;
	return min;
}

int main()
{
	//F R C F C R F
	int a, b, c, mini, max, set;
	int arr[7];

	scanf("%d %d %d", &a, &b, &c);

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

	for(int j =0; j<7; j++)
	{
		for(int i = 0; i<7; i++)
		{
			if((i+j)%7 == 0 || (i+j)%7 == 3 || (i+j)%7 == 6)
				{
					if(a == 0){
						set = i;
						break;
					}
					else{
						a--;
					}
				}
			if((i+j)%7 == 1 || (i+j)%7 == 5)
				{
					if(b == 0){
						set = i;
						break;
					}
					else
						b--;
				}
			if((i+j)%7 == 2 || (i+j)%7 == 4)
				{
					if(c == 0){
						set = i;
						break;
					}
					else
						c--;
				}
		}
		if(j == 0)
			max = set;
		else
		{
			if(set>max)
				max = set;
		}

	}

	printf("%d\n", max + 7*mini);
	return 0;
}

#include <stdio.h>
#define min(a,b) ((a)>(b)?(b):(a))
int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    int na = a / 3, nb = b / 2, nc = c / 2;
    int ans = min(na, min(nb, nc));
    na = a - ans*3, nb = b - ans*2, nc = c - ans*2;
    ans *= 7;
//    printf("remain a=%d, b=%d, c=%d, ans=%d\n", na, nb, nc, ans);
    na = min(2, na);
    nb = min(na, nb);
    nc = min(nb, nc);
    ans += na + nb + nc;
    printf("%d\n", ans);
}

#include<stdio.h>
#include<string.h>

int main(){

    long long  totald,min,a,b,c,ca,cb,cc;
    scanf("%lld%lld%lld",&a,&b,&c);
    ca=a/3;a=a%3;
    cb=b/2;b=b%2;
    cc=c/2;c=c%2;
    min=ca<cb?(ca<cc?ca:cc):(cb<cc?cb:cc);
    ca-=min;
    cb-=min;
    cc-=min;
    totald=min*7;
    a+=ca*3;
    b+=cb*2;
    c+=cc*2;

     //printf("%lld %lld %lld %lld\n",a,b,c,totald);

    long long count,max=-1,tmpa,tmpb,tmpc,arr[7];
    for(int i=0;i<7; i++){
        tmpa=a;
        tmpb=b;
        tmpc=c;
        memset(arr,0,sizeof(arr));
        for(int j=i;j<7; j++){
            if((j==0 || j==3) && tmpb){
                arr[j]=1;
                tmpb--;
            }
            else if((j==1 || j==2 || j== 5 )&& tmpa){
                arr[j]=2;
                tmpa--;
            }
            else if((j==4 || j==6 )&& tmpc){
                arr[j]=3;
                tmpc--;
            }
        }
        count=0;
        for(int k=i;k<7; k++){
            if(arr[k]==0)break;
          //printf("%d ",arr[k] );
            count++;
        }
      //puts("");
        if(count>max){
            max=count;
        }
    }
    printf("%lld\n",totald+max);
    return 0;
}

#include<stdio.h>
#include<string.h>

int main(){

    long long  totald,min,a,b,c,ca,cb,cc;
    scanf("%lld%lld%lld",&b,&a,&c);
    ca=a/3;a=a%3;
    cb=b/2;b=b%2;
    cc=c/2;c=c%2;
    min=ca<cb?(ca<cc?ca:cc):(cb<cc?cb:cc);
    ca-=min;
    cb-=min;
    cc-=min;
    totald=min*7;
    a+=ca*3;
    b+=cb*2;
    c+=cc*2;

  // printf("%lld %lld %lld %lld\n",a,b,c,totald);

    long long count,max=-1,tmpa,tmpb,tmpc,arr[7];
    for(int i=0;i<7; i++){
        tmpa=a;
        tmpb=b;
        tmpc=c;
        memset(arr,0,sizeof(arr));
        for(int j=i;j<7; j++){
            if((j==0 || j==3) && tmpa){
                arr[j]=1;
                tmpa--;
            }
            else if((j==1 || j==2 || j== 5 )&& tmpb){
                arr[j]=2;
                tmpb--;
            }
            else if(j==4 || j==6 && tmpc){
                arr[j]=3;
                tmpc--;
            }
        }
        count=0;
        for(int k=i;k<7; k++){
            if(arr[k]==0)break;
         //   printf("%d ",arr[k] );
            count++;
        }
       // puts("");
        if(count>max){
            max=count;
        }
    }
    printf("%lld\n",totald+max);
    return 0;
}

#include<stdio.h>
#include<string.h>

int main(){

    long long  totald,min,a,b,c,ca,cb,cc;
    scanf("%lld%lld%lld",&a,&b,&c);
    ca=a/3;a=a%3;
    cb=b/2;b=b%2;
    cc=c/2;c=c%2;
    min=ca<cb?(ca<cc?ca:cc):(cb<cc?cb:cc);
    ca-=min;
    cb-=min;
    cc-=min;
    totald=min*7;
    a+=ca*3;
    b+=cb*2;
    c+=cc*2;

   //printf("%lld %lld %lld %lld\n",a,b,c,totald);

    long long count,max=-1,tmpa,tmpb,tmpc,arr[7];
    for(int i=0;i<7; i++){
        tmpa=a;
        tmpb=b;
        tmpc=c;
        memset(arr,0,sizeof(arr));
        for(int j=i;j<7; j++){
            if((j==0 || j==3) && tmpa){
                arr[j]=1;
                tmpa--;
            }
            else if((j==1 || j==2 || j== 5 )&& tmpb){
                arr[j]=2;
                tmpb--;
            }
            else if(tmpc){
                arr[j]=3;
                tmpc--;
            }
        }
        count=0;
        for(int k=i;k<7; k++){
            if(arr[k]==0)break;
            count++;
        }
        if(count>max){
            max=count;
        }
    }
    printf("%lld\n",totald+max);
    return 0;
}

#include<stdio.h>
#include<string.h>

int main(){

    long long  totald,min,a,b,c,ca,cb,cc;
    scanf("%lld%lld%lld",&b,&a,&c);
    ca=a/3;a=a%3;
    cb=b/2;b=b%2;
    cc=c/2;c=c%2;
    min=ca<cb?(ca<cc?ca:cc):(cb<cc?cb:cc);
    ca-=min;
    cb-=min;
    cc-=min;
    totald=min*7;
    a+=ca*3;
    b+=cb*2;
    c+=cc*2;

     //printf("%lld %lld %lld %lld\n",b,a,c,totald);

    long long count,max=-1,tmpa,tmpb,tmpc,arr[7];
    for(int i=0;i<7; i++){
        tmpa=a;
        tmpb=b;
        tmpc=c;
        memset(arr,0,sizeof(arr));
        for(int j=i;j<7; j++){
            if((j==0 || j==3) && tmpa){
                arr[j]=1;
                tmpa--;
            }
            else if((j==1 || j==2 || j== 5 )&& tmpb){
                arr[j]=2;
                tmpb--;
            }
            else if((j==4 || j==6 )&& tmpc){
                arr[j]=3;
                tmpc--;
            }
        }
        count=0;
        for(int k=i;k<7; k++){
            if(arr[k]==0)break;
           //printf("%d ",arr[k] );
            count++;
        }
       //puts("");
        if(count>max){
            max=count;
        }
    }
    printf("%lld\n",totald+max);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
if(mini>1)
{

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;

}
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;
printf("%I64d %I64d %I64d ",a,b,c);
if(a==b && b==c)
    nr=nr+a+b+c;
if(a>b && a>c)
{
    if(b==0 && c==0)
        nr=nr+2;
        else
    if(b==c)
        nr=nr+a+b+c;
    else
    {
        if(b!=0 && c!=0)
            nr=nr+6;
        else
        {
            if(a==2)
                if(c==1)
                  nr=nr+3;
                else
                    if(b==1)
                        nr=nr+3;
            if(a==3)
            {
                if(b>0)
                    nr=nr+b+2;
                if(c>0)
                    nr=nr+c+1;
                }
        }
    }

}
else
if(b>a || c>a)
{

    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
if(a>3 || b>2 || c>2)
{

mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
}

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(a>0)
    {

        if(b==0 || c==0)
        {

        if(b==0)
            nr=nr+3;
        if(c==0)
            nr=nr+2;

        }

    if(b!=0 && c!=0 )
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    }
    else
        if(a==0 && c>0 && b>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;
nr=mini*7;
if(a==b && b==c)
    nr=nr+a+b+c;
if(a>b && a>c)
{
    if(b==0 && c==0)
        nr=nr+2;
        else
    if(b==c)
        nr=nr+a+b+c;
    else
    {
        if(b!=0 && c!=0)
            nr=nr+6;
        else
        {
            if(a==2)
                if(c==1)
                  nr=nr+3;
                else
                    if(b==1)
                        nr=nr+3;
            if(a==3)
            {
                if(b>0)
                    nr=nr+b+2;
                if(c>0)
                    nr=nr+c+1;
                }
        }
    }

}
else
{if(b>a || c>a)
    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;

}

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;
nr=mini*7;
if(a==b && b==c)
    nr=nr+a+b+c;
if(a>b && a>c)
{
    if(b==c)
        nr=nr+a+b+c;
    else
    {
        if(b!=0 && c!=0)
            nr=nr+6;
        else
        {
            if(a==2)
                if(c==1)
                  nr=nr+3;
                else
                    if(b==1)
                        nr=nr+3;
            if(a==3)
            {
                if(b>0)
                    nr=nr+b+2;
                if(c>0)
                    nr=nr+c+1;
                }
        }
    }

}
else
{if(b>a || c>a)
    if(b!=0 && c!=0 )
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else

        nr++;

}

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
if(a>3 || b>2 || c>2)
{

mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
}

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(a>0)
        if(b==0 || c==0)
        {

        if(b==0)
            nr=nr+3;
        if(c==0)
            nr=nr+2;

        }

     else
    if(b!=0 && c!=0  && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && b>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;
nr=mini*7;
if(a==b && b==c)
    nr=nr+a+b+c;
if(a>b && a>c)
{
    if(b==c)
        nr=nr+a+b+c;
    else
    {
        if(b!=0 && c!=0)
            nr=nr+6;
        else
        {
            if(a==2)
                if(c==1)
                  nr=nr+3;
                else
                    if(b==1)
                        nr=nr+3;
            if(a==3)
            {
                if(b>0)
                    nr=nr+b+2;
                if(c>0)
                    nr=nr+c+1;
                }
        }
    }

}
else
{if(b>a || c>a)
    if(b!=0 && c!=0 )
        nr=nr+a+2;
    else

        nr++;

}

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
if(a>3 || b>2 || c>2)
{

mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
}

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{
    if(a>0)
    {

        if(b==0)
            nr=nr+3;
        if(c==0)
            nr=nr+2;

    }

     else
    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && b>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
if(mini>1)
{

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;

}
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
if(a>3 || b>2 || c>2)
{

mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
}

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
if(mini>1)
{

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
}
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;
nr=mini*7;
if(a==b && b==c)
    nr=nr+a+b+c;
if(a>b && a>c)
{
    if(b==c)
        nr=nr+a+b+c;
    else
    {
        if(b!=0 && c!=0)
            nr=nr+6;
        else
        {
            if(a==2)
                if(c==1)
                  nr=nr+3;
                else
                    if(b==1)
                        nr=nr+3;
            if(a==3)
            {
                if(b>0)
                    nr=nr+b+2;
                if(c>0)
                    nr=nr+c+1;
                }
        }
    }

}
else
{if(b>a || c>a)
    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;

}

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;
nr=mini*7;
if(a==b && b==c)
    nr=nr+a+b+c;
if(a>b && a>c)
{
    if(b==0 && c==0)
        nr=nr+2;
        else
    if(b==c)
        nr=nr+a+b+c;
    else
    {
        if(b!=0 && c!=0)
            nr=nr+6;
        else
        {
            if(a==2)
                if(c==1)
                  nr=nr+3;
                else
                    if(b==1)
                        nr=nr+3;
            if(a==3)
            {
                if(b>0)
                    nr=nr+b+2;
                if(c>0)
                    nr=nr+c+1;
                }
        }
    }

}
else
if(b>a || c>a)
{

    if(b!=0 && c!=0 && a>0)
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && c>0)
            nr=nr+2;
    else

        nr++;
}
else
    if(a==b || a==c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

long long a ,b,c,mini,nr;

int main()
{
scanf("%I64d %I64d %I64d",&a,&b,&c);
if(a>3 || b>2 || c>2)
{

mini=a/3;
if(b/2 <mini)
    mini=b/2;
if(c/2 <mini)
    mini=c/2;
}

a=a-3*mini;
b=b-2*mini;
c=c-2*mini;
nr=mini*7;
if(a>3)
    a=3;
if(b>2)
    b=2;
if(c>2)
    c=2;

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

}
else
if(b>a || c>a)
{

    if(a>0)
        if(b==0 || c==0)
        {

        if(b==0)
            nr=nr+3;
        if(c==0)
            nr=nr+2;

        }

     else
    if(b!=0 && c!=0 )
    {

        if(c==2)
            nr=nr+a+b+c;
        else
            nr=nr+3;

    }
    else
        if(a==0 && c>0 && b>0)
            nr=nr+2;
    else

        nr++;

}
else

    if(a==b || a==c )
        if(b!=c)
        if(b==0 )
            nr=nr+3;
        else
            nr=nr+a+b+c;

printf("%I64d",nr);

    return 0;
}