#Lutece1268. Open the lightings
Open the lightings
Migrated from Lutece 1268 Open the lightings
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
There are light(s) in a row.These lights are numbered to from left to right.One of the lights are switched on.I wants to switch all the lights on. At each step I can switch a light on(this light should be switched off at that moment)if there's at least one "very close" light which is already switched on. More exactly: when No. light(this light is switched on now),No. light can be switched on(this light is switched off now) if and only if . I knows the initial state of lights and I wonder how many different ways there exist to switch all the lights on.
Please find the required number of ways modulo .
Input
The first line of the input contains two integers and where is the number of lights in the sequence and No. light are initially switched on,.
Output
In the only line of the output print the number of different possible ways to switch on all the lights modulo .
Samples
3 1
2
Resources
第七届ACM趣味程序设计竞赛第四场(正式赛)