2012. Factorials!!!

单点时限: 2.0 sec

内存限制: 256 MB

Definition 1. n!!…! = n(n-k)(n-2k)…(n mod k), if k doesn’t divide n,

n!!…! = n(n-k)(n-2k)…k, if k divides n (There are k marks ! in the both cases).

Definition 2. X mod Y ― a remainder after division of X by Y.

For example, 10 mod 3 = 1; 3! = 3・2・1; 10!!! = 10・7・4・1;

Given numbers n and k we have calculated a value of the expression in the first definition. Can you do it as well?

输入格式

There are several test cases.Each contains the only line: one integer n, 1 ≤ n ≤ 10, then exactly one space, then k exclamation marks, 1 ≤ k ≤ 20.

输出格式

contains one number ― n!!…! (there are k marks ! here).

样例

Input
9 !!
Output
945

89 人解决,145 人已尝试。

108 份提交通过,共有 401 份提交。

4.2 EMB 奖励。

创建: 16 年,11 月前.

修改: 7 年,2 月前.

最后提交: 2 周,2 天前.

来源: The 3rd high school children programming contest

题目标签