#include #define REP(a,b,c) for(int a=b; a<(int)c; a++) #define rep(a,b) REP(a,0,b) typedef long long int llint; using namespace std; int main(){ int A, B, S; cin >> A >> B >> S; int ans; if(S==1){ if(A==0) ans = 2; else ans = A; } else if(abs(A-S) <= abs(B-S)){ //A come ans = abs(A-S) + S; }else{ //B come ans = abs(B-S); if(A