Circle of Coins
Consider coins arranged in a circle where each coin shows heads or tails. A move consists of turning over consecutive coins: tail-head or head-tail. Using a sequence of these moves the objective is to get all the coins showing heads.
Consider the example, shown below, where and and the initial state is one coin showing tails (black). The example shows a solution for this state.

For given values of and not all states are solvable. Let be the number of states that are solvable. You are given that , and .
Further define:
You are also given that , and .
Find . Give your answer modulo .
硬币圈
枚硬币摆成一圈,初始状态下硬币任意地正面或反面朝上。每一次行动可以将相邻的枚硬币翻面:正面变为反面,反面变为正面。最终目标是通过一系列行动将所有的硬币翻为正面朝上。
考虑如下所示这个例子,其中,,初始状态下只有一枚硬币为反面(用黑色表示)。下图展示了其中一种将初始状态变为全正面朝上的解法。

对于给定的和的取值,不是所有的初始状态都能够完成目标。记为所有能够完成目标的初始状态数目。已知,,。
进一步地,记
已知,,。
求,并将你的答案对取余。
Gitalking ...