I have an IR that uses apex_item.checkbox to create a column checkboxes

First users enter values for techs and hours and i calculate the answer(display_only item) = techs*hours.
Then the users select one/many rows in from the schedule column. Now I must reduce the answer value by the duration_hrs value for the selected rows, and when the rows is deselected increase the answer by the duration_hrs value for the deselected rows.
For example, if i select the first 2 rows, the answer should changed to (60-2-2.5) = 55.5. And I deselect the 2nd row only, answer should change to 58
Any help would be very much appreciated.
Thanks