Ugh. Inelegant solution. The problem description is inconsistent. The solution works with the provided data inputs and outputs.