added both functions of the fenwickTree