Range Sum Query 2D - Immutable

Imagine a large, rectangular plot of land divided into smaller squares, each representing a different type of crop. The value of each crop is represented by a numerical value. A farmer wants to calculate the total value of crops in a specific rectangular region of the plot. Given a 2D matrix representing the plot, design a system to efficiently calculate the total value of crops in any rectangular region.

Examples
Input: [["Solution","sumRegion","sumRegion","sumRegion"],[[[[3,0,1,4,2],[5,6,3,2,1],[1,2,0,1,5],[4,1,0,1,7],[1,0,3,0,5]]],[2,1,4,3],[1,1,2,2],[1,2,2,4]]]
Output: [null,8,11,12]
Hints

Range Sum Query 2D - Immutable

Imagine a large, rectangular plot of land divided into smaller squares, each representing a different type of crop. The value of each crop is represented by a numerical value. A farmer wants to calculate the total value of crops in a specific rectangular region of the plot. Given a 2D matrix representing the plot, design a system to efficiently calculate the total value of crops in any rectangular region.