def query_left(tree, index):
    """Returns sum of values between 1-index inclusive.

    Args:
        tree: BIT
        index: Last index to include to the sum

    Returns:
        Sum of values up to given index
    """
    res = 0

    while index:
        res += tree[index]
        index -= (index & -index)

    return res