CF821E Okabe and El Psy Kongroo

Description

Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to know how many different walks he can take in his city safely. Okabe's city can be represented as all points $ (x,y) $ such that $ x $ and $ y $ are non-negative. Okabe starts at the origin (point $ (0,0) $ ), and needs to reach the point $ (k,0) $ . If Okabe is currently at the point $ (x,y) $ , in one step he can go to $ (x+1,y+1) $ , $ (x+1,y) $ , or $ (x+1,y-1) $ . Additionally, there are $ n $ horizontal line segments, the $ i $ -th of which goes from $ x=a_{i} $ to $ x=b_{i} $ inclusive, and is at $ y=c_{i} $ . It is guaranteed that $ a_{1}=0 $ , $ a_{n}

Input Format

The first line of input contains the integers $ n $ and $ k $ ( $ 1

Output Format

Print the number of walks satisfying the conditions, modulo $ 1000000007 $ ( $ 10^{9}+7 $ ).

Explanation/Hint

![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/f658e3b02a94b26e1ceda15b31b9ad31fd8decfb.png)The graph above corresponds to sample 1. The possible walks are: - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/fe5ddffd345db7dbc9811066d89af8164e156a48.png) - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/3c1f68141260e9f0faf2c18d37cc945fe3064803.png) - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/6d7eca326042aa73d0e36209e3dcf0b53f326988.png) - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/b384b506ab41aac1cef00012023de00c92c6ca52.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/808ba51553ca63393b29c100184e006bbe68cb46.png)The graph above corresponds to sample 2. There is only one walk for Okabe to reach $ (3,0) $ . After this, the possible walks are: - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/c65499d5e0d037bc0e099631cfbdc3b47191ec5c.png) - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/ea64d72ce9bbedf50ad31137fb330842e8e48b14.png) - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/f552304e1f485b618079fd34e72f22adaf988bc2.png) - ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF821E/9c27a4273309f39ff98075265ceb3af61e3cd1cb.png)