Codeforces Round 179 (Div. 1)
D
Greg and Caves
Codeforces
2400
原题
← CE →
翻译中…

Greg has a pad. The pad's screen is an $*n* × *m*$ rectangle, each cell can be either black or white. We'll consider the pad rows to be numbered with integers from 1 to $*n*$ from top to bottom. Similarly, the pad's columns are numbered with integers from 1 to $*m*$ from left to right.

翻译中…

Greg thinks that the pad's screen displays a cave if the following conditions hold:

翻译中…
  • There is a segment $[*l*, *r*]$ $(1 ≤ *l* ≤ *r* ≤ *n*)$, such that each of the rows $*l*, *l* + 1, ..., *r*$ has exactly two black cells and all other rows have only white cells.
  • There is a row number $*t*$ $(*l* ≤ *t* ≤ *r*)$, such that for all pairs of rows with numbers $*i*$ and $*j*$ $(*l* ≤ *i* ≤ *j* ≤ *t*)$ the set of columns between the black cells in row $*i*$ (with the columns where is these black cells) is the subset of the set of columns between the black cells in row $*j*$ (with the columns where is these black cells). Similarly, for all pairs of rows with numbers $*i*$ and $*j*$ $(*t* ≤ *i* ≤ *j* ≤ *r*)$ the set of columns between the black cells in row $*j*$ (with the columns where is these black cells) is the subset of the set of columns between the black cells in row $*i*$ (with the columns where is these black cells).
翻译中…

Greg wondered, how many ways there are to paint a cave on his pad. Two ways can be considered distinct if there is a cell that has distinct colors on the two pictures.

翻译中…

Help Greg.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$, $*m*$ — the pad's screen size $(1 ≤ *n*, *m* ≤ 2000)$.

翻译中…

Output

翻译中…

In the single line print the remainder after dividing the answer to the problem by $1000000007$ $(10^{9} + 7)$.

翻译中…

样例

Input #1
1 1
Output #1
0
InputCopy OutputCopy
Input #2
4 4
Output #2
485
InputCopy OutputCopy
Input #3
3 5
Output #3
451
InputCopy OutputCopy
题目信息
题号
295D
时间限制
2 s
内存限制
256 MB
标签
组合数学
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。