'initialize your data structure here.
:type matrix: List[List[int]]'

def __init__(self, matrix):

    if (not matrix):
        return
    (m, n) = (len(matrix), len(matrix[0]))
    self.__sums = [[0 for _ in xrange((n + 1))] for _ in xrange((m + 1))]
    for i in xrange(1, (m + 1)):
        for j in xrange(1, (n + 1)):
            self.__sums[i][j] = (self.__sums[i][(j - 1)] + matrix[(i - 1)][(j - 1)])
    for j in xrange(1, (n + 1)):
        for i in xrange(1, (m + 1)):
            self.__sums[i][j] += self.__sums[(i - 1)][j]
