You are given a grid of R rows and C columns where every cell is 0 or 1. Count the total number of axis-aligned square blocks (of every side length, at every position) whose cells are all 1. A single 1 cell counts as a 1x1 square.
Input format
Line 1: two integers R and C.
Next R lines: each has C space-separated values, every value 0 or 1.
Output format
A single integer: the total number of all-ones square blocks.
Constraints
- 1 <= R, C <= 300
- each cell is 0 or 1