import copy


def subtract_from_all(xs, num):
    """
    Helper function to subtract num from all values in x dictionary,
    without modifying the x dictionary.
    """
    new = copy.deepcopy(xs)
    for k in new:
        new[k] -= num
    return new