#include #include #include #define int ptrdiff_t #define div lldiv #define div_t lldiv_t #define abs(a) ((a)<0?-(a):(a)) int A,B,S; int calc(void) { if (S == 1 || abs(A-S) <= abs(B-S)) return abs(A-S) + abs(S-0); return abs(B-S) + abs(S-1) + abs(A-1) + abs(1-0); } main(){ int ans = 0; scanf("%td%td%td\n", &A,&B,&S); printf("%td\n", calc()); return 0; }