use integer; <>; for(<>){ ($a,$b,$c)=glob; $d=$b>>1; $b-=$d*2; $e=$a<$c?$a:$c; $a-=$e; $c-=$e; $f=$a<$b?$a:$b; $g=$c>>1; print$d*2+$e*2+$f+$g,$/; }