def time_spent_number(calls):
    """Return a dictionary with time spent for each number.
    Args:
        calls: list of calls
    Returns:
        dictionary with time spent for each number
    """
    time_spent = {}
    for call in calls:
        caller = call[0]
        receiver = call[1]
        duration = call[3]
        time_spent[caller] = time_spent.get(caller, 0) + int(duration)
        time_spent[receiver] = time_spent.get(receiver, 0) + int(duration)

    return time_spent