(iv) Such merit time allowance may be granted when an incarcerated individual successfully participates in the work and treatment program assigned pursuant to section eight hundred five of this article and when such incarcerated individual obtains a general equivalency diploma, an alcohol and substance abuse treatment certificate, a vocational trade certificate following at least six months of vocational programming, at least eighteen credits in a program registered by the state education department from a degreegranting higher education institution or performs at least four hundred hours of service as part of a community work crew. Such allowance shall be withheld for any serious disciplinary infraction or upon a judicial determination that the person, while an incarcerated individual, commenced or continued a civil action, proceeding or claim that was found to be frivolous as defined in subdivision (c) of section eight thousand three hundred three-a of the civil practice law and rules, or an order of a federal court pursuant to rule 11 of the federal rules of civil procedure imposing sanctions in an action commenced by a person, while an incarcerated individual, against a state agency, officer or employee.