Sum of all submatrix approach 2

i cant understand how to implement the logic .
please anyone can send the code.
it wil be great help

@Diwyanshu
hello Diwyanshu,
please refer this code->
https://ide.codingblocks.com/s/195084?_ga=2.147180848.626417516.1584426581-882484569.1584426581

@aman yadav sir for help