There are no number grades in that code. Anyways, I assume you just want to omit all the F's and just average the numerical value of the remaining letter grades. Since you already counted how many of each letter grade, you can just do something like:
average = (90*a + 80*b + 70*c + 60*d)/(a+b+c+d)
This excludes all the F's and gets you the average. Of course, you might want to change the values of each letter grade to something that makes more sense.