#include <iostream>
#include <vector>

using namespace std;

int main()
{
	vector<int> d(3);
	int ans = 0;
	for (auto& x : d) {
		cin >> x;
		ans += 7 - x;
	}
	cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
int d4r[] = {1, 0, -1, 0}, d4c[] = {0, 1, 0, -1};
int d8r[] = {1, 1, 0, -1, -1, -1, 0, 1}, d8c[] = {0, 1, 1, 1, 0, -1, -1, -1};
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr int INF = 1001001001;
constexpr long long LINF = 1001002003004005006;
constexpr double PI = acos(-1);
template<typename T> inline void chmax(T &a, T b) {a = max(a, b);}
template<typename T> inline void chmin(T &a, T b) {a = min(a, b);}

int main() {
    int a,b,c; cin >> a >> b >> c;
    cout << 21- a-b-c << '\n';
    return 0;
}
