When same-kind pledged dirhams perish, what determines the setoff?

Kitab al-Rahn: Salam, Sarf, Third-party Custody and Fungible Collateral