<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def classical_damage(riskinputs, riskmodel, param, monitor):
 """ Core function for a classical damage computation. :param riskinputs: :class:`openquake.risklib.riskinput.RiskInput` objects :param riskmodel: a :class:`openquake.risklib.riskinput.CompositeRiskModel` instance :param param: dictionary of extra parameters :param monitor: :class:`openquake.baselib.performance.Monitor` instance :returns: a nested dictionary lt_idx, rlz_idx -> asset_idx -> <damage array> """

    result = AccumDict(accum=AccumDict())
    for ri in riskinputs:
        for out in riskmodel.gen_outputs(ri, monitor):
            for l, loss_type in enumerate(riskmodel.loss_types):
                ordinals = ri.assets['ordinal']
                result[l, out.rlzi] += dict(zip(ordinals, out[loss_type]))
    return result