#include <iostream>
using namespace std;

int main () {
int n,d,k,b,s,a;
cin>>n>>d>>k;
a=n+d+k*3-3;
s=d+k+n*3-3;
b=n+k+d*3-3;
if (n>k) {
cout<<"";
}
if (n>d) {
cout<<s;
}
if (d>k) {
cout<<"";
}
if (d>n) {
cout<<b;
}
if (k>n) {
cout<<"";
}
if (k>d) {
cout<<a;
}

return 0;
}
