Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 点
問題文
あなたは 日の間、毎日次の つの行動のうちどれか つを行います。
- 円払ってガムを買う。
- 円払って飴を買う。
- 円払ってチョコを買う。
- 円払って麩菓子を買う。
あなたは 日間で合計 円を払いました。条件を満たす 日間の行動は何通りありますか?答えを で割った余りを求めてください。
ただし、 つの行動は、買ったものが つの行動の間で異なる日が存在する時に別々に数えます。
制約
- は整数
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
2 7
出力例 1Copy
4
条件を満たす 日間の行動は次の 通りです。
- 日目に 円払ってガムを買い、 日目に 円払って麩菓子を買う。
- 日目に 円払って飴を買い、 日目に 円払ってチョコを買う。
- 日目に 円払ってチョコを買い、 日目に 円払って飴を買う。
- 日目に 円払って麩菓子を買い、 日目に 円払ってガムを買う。
入力例 2Copy
200000 1000000
出力例 2Copy
688682037
Score: points
Problem Statement
For days, each day you choose exactly one of the following four actions:
- Pay yen and buy gum.
- Pay yen and buy candy.
- Pay yen and buy chocolate.
- Pay yen and buy wheat gluten snack.
After days, you have paid a total of yen.
How many possible sequences of days satisfy this condition? Output the answer modulo .
Two sequences are considered different if there exists at least one day on which the purchased item is different.
Constraints
- are integers
Input
The input is given from standard input in the following format:
Output
Print the answer.
Sample Input 1Copy
2 7
Sample Output 1Copy
4
There are valid action sequences for days:
- On day , pay yen for gum; on day , pay yen for wheat gluten snack.
- On day , pay yen for candy; on day , pay yen for chocolate.
- On day , pay yen for chocolate; on day , pay yen for candy.
- On day , pay yen for wheat gluten snack; on day , pay yen for gum.
Sample Input 2Copy
200000 1000000
Sample Output 2Copy
688682037