This will make more sense if you look at how the inputs a,b,n in the toy (2,2,3) and (2,3,3) present differently.