ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Contest is over

## B. Factorials!!!

Time limit: 1.0 second
Memory limit: 64 MB
Definition 1. n!!…! = n(nk)(n−2k)…(n mod k), if k doesn’t divide n; n!!…! = n(nk)(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?

### Input

contains the only line: one integer n, 1 ≤ n ≤ 10, then exactly one space, then k exclamation marks, 1 ≤ k ≤ 20.

### Output

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

### Sample

inputoutput
```9 !!
```
```945
```
Problem Author: Oleg Katz
Problem Source: The 3rd high school children programming contest, USU, Yekaterinburg, Russia, March 4, 2001
To submit the solution for this problem go to the Problem set: 1083. Factorials!!!