Use of BIT in HackerEarth problem

https://www.hackerearth.com/problem/algorithm/polynomial-queries-28458f8a/description/ is the link of the problem. It is a nice one from DSA June 2020 contest. Though I barely managed to land 5th in the contest, I felt disappointed on not being able to use BIT efficiently here. I know the solution for tighter limits on A[i] like 0<=A[i]<=10. Please help me.