#!/usr/bin/perl use warnings; use strict; my ($a, $b, $s) = split / /, <>; my $x = $a - $s; my $y = $b - $s; my $count = 0; if($x < 0) { $x *= -1; } if($y < 0) { $y *= -1; } if($a <= $b) { $count = $x + $s; } else { $count = $y; $y = $a - $b; if($y < 0) { $y *= -1; } if($a < $y) { $count += $a; } else { $count += $y + $a; } } print "$count\n"; exit;