negative input and output throws exception