Handle invalid input by raising InputError #5