Travel around China

아직 제출이 없습니다시간 제한8초메모리 제한512 MB

문제

Rikka is a rich girl.

She would like to visit the beautiful cities of China. The city locations in China can be simply regarded as a grid that contains nn rows and mm columns. Rows are numbered by 11 to nn from north to south, and columns are numbered by 11 to mm from west to east. The city located in the ii-th row and the jj-th column is called (i,j)(i, j).

There are some expressways that connect the whole country. City (i,j)(i, j) has a direct expressway to city (x,y)(x, y) if and only if ix+jy=1|i - x| + |j - y| = 1. Because New Year is coming, expressways are opened to the public free of charge.

When Rikka travels from city (i,j)(i, j) to (x,y)(x, y), she can only travel through expressways. The cost of a travel route is the sum of the costs of all the cities she visits, including the starting and the ending cities. If the route includes some city, she will visit scenic spots, go shopping, and spend money. If the route includes city (i,j)(i, j), she will spend a_i,ja\_{i, j} yuan. And if she visits city (i,j)(i, j) a total of kk times, she will spend ka_i,jk \cdot a\_{i, j} yuan, because there are always enough shopping malls for her to spend money.

Rikka is a fanciful girl, she does not even set the starting and the ending city. She wants to know the sum of costs of all the cheapest routes with different starting and ending cities. In other words, let f(i,j,x,y)f (i, j, x, y) be the minimal cost of the route that starts from city (i,j)(i, j) and ends at city (x,y)(x, y). She wants to know the value _i=1n_x=1n_j=1m_y=1m\[(i,j)(x,y)]f(i,j,x,y).\sum \limits\_{i = 1}^n \sum \limits\_{x = 1}^n \sum \limits\_{j = 1}^m \sum \limits\_{y = 1}^m \[(i, j) \neq (x, y)] f (i, j, x, y)\text{.}

Because the answer may be very large, you just need to tell her the answer modulo 1,000,000,0071\\,000\\,000\\,007 (that is, 109+710^9 + 7).

입력

The first line contains two integers nn and mm.

Each of the following nn lines contains mm integers. The jj-th number in the ii-th line is the value of a_i,ja\_{i, j}.

It is guaranteed that n=3n = 3, 1m1.51051 \le m \le 1.5 \cdot 10^5, and 1a_i,j1091 \le a\_{i, j} \le 10^9.

출력

Output a single line with a single integer, the answer modulo 1,000,000,0071\\,000\\,000\\,007 (that is, 109+710^9 + 7).