please check input task and recursion