#include #include using namespace std; int main() { int A, B, S, AS, BS; cin >> A >> B >> S; AS = abs(A - S); BS = abs(B - S); if (A == 0) cout << BS + S + 1; else if (AS <= BS) cout << AS + S; else if (S) cout << BS + S + A - 1; else cout << BS + AS + A; return 0; }