Case 1: 0 Case 2: impossible Case 3: 9