from typing import Dict


class DictionaryOperations(object):
    @staticmethod
    def merge_counting_dicts(items_list):
        # type: (list[dict]) -> dict

        response = {}
        for d in items_list:
            for key, value in d.items():
                response[key] = value + response.get(key, 0)

        return response

    @staticmethod
    def unmerge_counting_dict(subtract_from, items):
        # type: (Dict, Dict) -> Dict

        response = subtract_from.copy()
        for key, value in items.items():
            if response.get(key) is not None:
                response[key] = response.get(key, 0) - value

        return response
