def update_corpus_statistics(cs, ds):
    """
    Updates corpus-level statistics (cs)
    using document-level statistics (ds).
    """

    cs['tna'] += ds['rna']
    cs['tnc'] += ds['rnc']
    cs['tnb'] += ds['rnb']

    if ds['mnc'] > cs['mnc']:
        cs['la'] = ds['la']

    cs['mnc'] = max(cs['mnc'], ds['mnc'])
    cs['mnb'] = max(cs['mnb'], ds['mnb'])

    return cs