#include using namespace std; int main(){ int a,b,s; cin>>a>>b>>s; if (a <= b) { cout << (a == 0 ? 1 : 0) + min(abs(s - b), abs(s - a)) + s << endl; } else { cout << (abs(s - b) < abs(s - a) ? a + abs(s - b) : a) << endl; } }