#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>A>>B>>S; if(abs(A-S)<=abs(B-S)) { cout<S) { x+=min(A-S+A,(S-1)+A); } else if(A==0) { x+=(S-1)+2; } else x+=S; cout<