def query_range(tree, start, end):
    """Returns sum of values between start-end inclusive.

    Args:
        tree: BIT
        start: First index to include to the sum
        end: Last index to include to the sum

    Returns:
        Sum of values within given range
    """
    res = 0
    start -= 1

    while end > start:
        res += tree[end]
        end -= (end & -end)

    while start > end:
        res -= tree[start]
        start -= (start & -start)

    return res