Since Blockly doesn't accept function's argument & every variables is global. So I made a recursive stack just for this.
See the picture or copy this xml code and paste into XML tab in this page to see live demo yourself.
May the code be with you. :3