Submatrix sum query

Is the time complexity of the approach in video leacture is O(no. of queries) ?

but then pre computation in calculating the prefix sum
will cater to the time complexity

so it will be prefix sum time complexity + no of queries