Div1, Recursion, Level 1
Initial attempt
Corrected a borderline case