Modify function to Raise ValueError on negative input