A model of the indirect losses from negative shocks in production and finance