#include<bits/stdc++.h>
using namespace std;
int main(){
    int a ,b, c;
    cin >> a >> b >> c;
    if(a%6==1){
        a = 6;
    }else if(a%6==2){
        a = 5;
    }else if(a%6==3){
        a = 4;
    }else if(a%6==4){
        a = 3;
    }else if(a%6==5){
        a = 2;
    }else if(a%6==0){
        a = 1;
    }
    if(b%6==1){
        b = 6;
    }else if(b%6==2){
        b = 5;
    }else if(b%6==3){
        b = 4;
    }else if(b%6==4){
        b = 3;
    }else if(b%6==5){
        b = 2;
    }else if(b%6==0){
        b = 1;
    }
    if(c%6==1){
        c = 6;
    }else if(c%6==2){
        c = 5;
    }else if(c%6==3){
        c = 4;
    }else if(c%6==4){
        c = 3;
    }else if(c%6==5){
        c = 2;
    }else if(c%6==0){
        c = 1;
    }
    cout << a+b+c << endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

int main(void)
{
    ll a,b,c;

    cin >> a >> b >>c;

    cout << 7-a+7-b+7-c << endl;
    
    return 0;
}
