A value needed after a block must be declared in an outer scope. The block can still assign its result.
The inner declaration creates a block-only total, so the outer value stays undefined. Repair the calculation so the shared variable becomes 25 and the final output can read it.