#include #include int main() { int a, b, s; std::cin >> a >> b >> s; int dist_a = std::abs(a - s), dist_b = std::abs(b - s); int ans; if (dist_a < dist_b || dist_a == dist_b) { ans = dist_a + s; } else { ans = dist_b + s - 1; ans += std::abs(1 - a) + 1; } std::cout << ans << std::endl; }