/*
            Bismillahir Rahmanir Rahim
            Read in the name of Allah, who created you!
            Al Mashruf Tonoy
            Department of CSE, Daffodil Internatinal University.
*/
/*
            Bismillahir Rahmanir Rahim
            Read in the name of Allah, who created you!
            Al Mashruf Tonoy
            Department of CSE, Daffodil Internatinal University.
*/
#include <bits/stdc++.h>
using namespace std;

int d(int n)
{
    if(n==1)
	{
		return 6;
	}
	else if(n==6)
	{
		return 1;
	}
	else if(n==2)
	{
		return 5;
	}
	else if(n==5)
	{
		return 2;
	}
	else if(n==3)
	{
		return 4;
	}
	else if(n==4)
	{
		return 3;
	}
}

int main()
{
	for(int i=0; i<3; i++)
	{
		int a,b,c;
		cin>>a>>b>>c;
		cout<<d(a)+d(b)+d(c);
		return 0;
	}

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

using namespace std;

int main()
{
    int arr[7] = {0,6,5,4,3,2,1};
    int a ,b,c;
    cin >> a >> b >> c;
    cout << (arr[a]+arr[b]+arr[c]) << "\n";
    return 0;
}
