What's my question record? There's a confusing factor in the 'Curious' badge. The "Positive question record".

(total questions - negative questions - closed - deleted)/total questions is the formula of the question record. (negative, closed and deleted 'stack' with each other. that means if a question is negative and closed, it counts as two minus.)

Luckily, you know a list of your questions. Make a program that calculates your question record.

The Input

You will be given an array of question datas. A question data is made of 2 datas.


The votes (integer)
The state (o(open), c(closed), d(deleted), b (closed and deleted) is the default, You may change the type and the characters for each states.)


Examples


[[-1,'o'],[1,'o']] => 0.5 (2 total, 1 minus points)
[[-1,'d'],[2,'c']] => -0.5 (2 total, 3 minus points)
[[-1,'b']] => -2 (1 total, 3 minus points)
[[23,'o'],[7,'c'],[7,'c'],[-1,'o'],[-5,'b'],[-11,'d'],[-3,'d'],[-3,'b'],[-15,'b']] => -0.77778(The precision is 5 digits past decimal point, rounded half-up. fractions are acceptable) (Oh my, my question record is horrible.)
`
('Minus points' is the sum of negative, closed and deleted.)


Rules


Format of input is your choice. You don't necessarily need to use the format in the Examples.


Reference
dc, 8 bytes
I've been waiting to use dc's feature, that the input is both data and code, for quite some time.
0d?n47Pp

The idea behind the script is that all of the number crunching will be done by the question's state representation, a valid input string. The main script's task is then to initialize the counters, read the input (and execute it as code at the same time), and print the result when done, as a fraction.
Here are the strings I use to represent the state. The OP allows non-char types!

'o' -&gt; &quot;1r[1-]sX0&gt;X0-+r1+r&quot;
'c' -&gt; &quot;1r[1-]sX0&gt;X1-+r1+r&quot;
'd' -&gt; &quot;1r[1-]sX0&gt;X1-+r1+rrr&quot;

The extra &quot;rr&quot; part at the end changes nothing, it is there to differentiate the d state from c.

'b' -&gt; &quot;1r[1-]sX0&gt;X2-+r1+r&quot;

Try it online! The default input there is the last example.
Test run: from the 2nd example. Negative numbers in dc are given with _ as the minus sign. This is allowed by this meta consensus.
dc -f question_record.dc &lt;&lt;&lt; &quot;_1 1r[1-]sX0&gt;X1-+r1+rrr 2 1r[1-]sX0&gt;X1-+r1+r&quot;
-1/2


Explanation of the script:
0d
# push 0 twice. The bottom cell will keep track of the number of questions, and the
#top cell of the sum part of the score.
?
# read input, which in this case is actually pairs of (data, code), that do all the
#number crunching
n47Pp
# print the 2 cells as a fraction: print top, print '/' (ASCII 47), print bottom

Explanation of the state's representation: I take the c state as example code
The stack at the start of this snippet is composed of the two bottom counters, plus the integer data (the votes) that was pushed on top before this. The snippet contains both the integer value of the state (minus points) and the dc code needed to apply it.
1r[1-]sX0&gt;X1-+r1+r

I work with the following iterative algorithm (pseudo-code) to calculate the &quot;positive question record&quot;:
result = 0
# main script: `0`
sum = 0
# main script: `d`
for each input question; do
# main script:`?`
    sum += 1
    # snippet: `1`
    sum -= v (0 if total votes are positive, 1 if negative)
    # snippet: `r[1-]sX0&gt;X`
    sum -= minus_points (based on state)
    # snippet: `1-`, or `0-`, or `2-`
    result++
    # snippet: `r1+`
done
result = sum / result
# main script:`n47Pp`