def update(len_a, t, idx_change, change, f=min, ignore=float('inf')):
    """
    Given an index in the original array a and the change to be applied at this index, update the
    full binary tree to be used for Range Queries
    :param len_a:   the array to search min
    :param t:       the full binary tree for RMQ, has to be prepared before calling this function
    :param idx_change:  the index in a where the element is being updated
    :param change:      f-specific change to idx_change-th element of a, e.g., a_new[idx_change] for f=sum,
                        or a_new[idx_change] - a[idx_change] for f = min/max
    :param f: min or max (or "similar") function
    :param i  ignore:  e.g., it is float('inf') if f==min else -float('inf') if f==max else 0 #if f==sum
    :return:  the full binary tree updated with the new value at a given index, to be used for RQs of a
    """
    if not 0 <= idx_change <= len_a - 1:
        raise IndexError('idx_change=%d is out of bounds' % idx_change)
    idx = 0
    s, e = 0, len_a - 1
    while s <= e and idx < len(t):
        t[idx] = f((t[idx], change))
        mid = s + (e - s) // 2
        if idx_change <= mid:
            e = mid
            idx = 2 * idx + 1
        else:
            s = mid + 1
            idx = 2 * idx + 2
    return t
