print<>*(($x,$0,$y,$w)=map({y/2//,y/1//}<>),$x+$y)-$x*$y+${$x?$y:$y|$0<$w?w:0}