#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int a, b ,c;
  cin >> a >> b >> c;
  cout << 7-a+7-b+7-c << endl;
  return 0;
}
#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define endl "\n"
#define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long mod=1e6+3;
const double PI=acos(-1);
int main()
{
    Sara
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector<char>v(3);
    for(int i=0;i<3;i++) cin>>v[i];
    char d=v[0];
    v[0]=v[1];
    v[1]=v[2];
    v[2]=d;
    for(int i=0;i<3;i++){
        cout<<v[i];
    }
        return 0;
}
