#include #include #include #include #include int main() { long i; long a, b, s; long a_s; long b_s; long ans; std::cin >> a >> b >> s; a_s = abs(a-s); b_s = abs(b-s); if( a == 0 ) { ans = 2 * s; } else { if(a_s > b_s) { ans = b_s + abs(a-b) + a; } else { ans = a_s + s; } } std::cout << ans << std::endl; return 0; }