google sheets – Check for criterion in multiple non-adjacent columns, display results from 1 column to the right

Previously posted but closed as duplicate with link to the question below

Original question: Sum values to the right of criteria in multicolumn range
Proposed answer/duplicate: Sum values with same name

Original question
I apologize in advance because I don’t even know how to describe this best.

But, I have 3 3-column ranges in which the left columns are IDs, the middle columns are names, and the right column is quantity I’d like to sum up.

There is some overlap between ID’s in left columns.

I created a column of sorted unique ID’s but could not come up with formulas to populate the names and then sum the values.

Ideally, the formula would also work with “arrayformula” as the columns may get very lengthy.

Here’s an example spreadsheet https://docs.google.com/spreadsheets/d/1z6qx4JGl-RGm3GExhEcxoTby7DTRSaRfLo-3VGwucvk/edit?usp=sharing

THANK YOU all