minal i'm stuck with gen functions too, i solved it by calculating number of non negative integral solutions