OI Problems   关于

#fr29kn. Two Arrays

时间限制:1 s       空间限制:256 MiB       标签: 数学 组合数学 组合计数 CodeForces 缺题解 

算法难度等级:0       思维难度等级:0       实现难度等级:0


本题来源于:Educational Codeforces Round 80 (Rated for Div. 2) Problem C

  • 简体中文
  • English

题目描述

输入两整数 nnmm,求有多少对正整数序列 aia_ibib_i 满足:

  • aia_ibib_i 的长度为 mm
  • aia_ibib_i 中所有元素的值小于等于 nn
  • 对于所有 1im1\le i\le maibia_i\le b_i
  • 序列 aa 单调不降,序列 bb 单调不升。

答案对 109+710^9+7 取模。

样例

2 2
5
10 1
55
723 9
157557417

You are given two integers nn and mm . Calculate the number of pairs of arrays (a,b)(a, b) such that:

  • the length of both arrays is equal to mm ;
  • each element of each array is an integer between 11 and nn (inclusive);
  • aibia_i \le b_i for any index ii from 11 to mm ;
  • array aa is sorted in non-descending order;
  • array bb is sorted in non-ascending order.

As the result can be very large, you should print it modulo 109+710^9+7 .

Input

The only line contains two integers nn and mm ( 1n10001 \le n \le 1000 , 1m101 \le m \le 10 ).

Output

Print one integer – the number of arrays aa and bb satisfying the conditions described above modulo 109+710^9+7 .

Samples

2 2
5
10 1
55
723 9
157557417

Tips

In the first test there are 55 suitable arrays:

  • a=[1,1],b=[2,2]a = [1, 1], b = [2, 2] ;
  • a=[1,2],b=[2,2]a = [1, 2], b = [2, 2] ;
  • a=[2,2],b=[2,2]a = [2, 2], b = [2, 2] ;
  • a=[1,1],b=[2,1]a = [1, 1], b = [2, 1] ;
  • a=[1,1],b=[1,1]a = [1, 1], b = [1, 1] .