Logic of Input and output result | ScratchStats