def sum_dict(a, b):
    """
    Sum the corresponding keys of numeric dictionaries a and b
    """

    if not a:
        return b

    if not b:
        return a

    return {k: a.get(k, 0) + b.get(k, 0) for k in a.keys() | b.keys()}