f(){ read k x echo $[!n?n=k,k=n/2+2,2-n%2:k] $[n+2-k-x] read&&f } f :