All problems

When We Say Yes, Are We Right?

mediumPythonML Metrics

Harborline's screening model flags parcels for hand inspection, and every flag costs a worker two minutes at the bench. The floor manager does not care how clever the model is; she cares that her team is not being sent to open clean boxes. Out of every hundred parcels the model flags, she wants to know how many were worth opening.

Task: Print the share of flagged parcels that really did contain a banned item.

Input

The first line holds an integer n, the number of parcels. Each of the next n lines holds two values separated by a single space: the true label first, the model's label second. Both are 1 (banned item inside) or 0 (clean). At least one parcel is flagged, so the answer always exists.

Output

One line: a number between 0 and 1 with exactly two digits after the decimal point. Print 1.00, not 1, when every flag was justified.

Example:

Input:
5
1 1
0 1
1 1
0 0
1 0

Output:
0.67

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…