def merge_dict(dict1, dict2):
    """
    Merge keys of dict1 and dict2.
    If a key is in the 2 dictionaries, then add the values.

    Args:
        dict1 (dict): any dictionary
        dict2 (dict): any dictionary

    Returns:
        merged_dict (dict): the union of the 2 inputs with added values.

    """

    # Start from dict1
    merged_dict = dict1.copy()

    # Add all key of dict2 to dict1
    for key in dict2.keys():

        # If in both, the values are added
        if key in dict1.keys():

            merged_dict[key] += dict2[key]

        # Otherwise, just add the new key and value
        else:

            merged_dict[key] = dict2[key]

    # Return the merged dict
    return merged_dict