#include <bits/stdc++.h>
#define pan(i,l,r) for(int i=l ; i < r; i++)
#define ll long long int
#define pb push_back
#define PI 3.141592653
#define pll pair<ll,ll>
#define V vector
#define F first
#define S second
#define INF INT_MAX

using namespace std;

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

void solve(){
    ll a, b, c;
    cin >> a >> b >> c;
    map<ll,ll> m;
    m[1] = 6;
    m[6] = 1;
    m[2] = 5;
    m[5] = 2;
    m[3] = 4;
    m[4] = 3;
    cout << m[a]+m[b]+m[c] << endl;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tst = 1;
    //cin >> tst;
    while(tst--)
        solve();
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
    int a, b , c;
    cin >> a >> b >> c;
    cout << 21 - (a + b + c) << '\n';
}