#00009D

z-factorials

N factorial (N!) is defined as the product of all the numbers from N to 1, N•(N-1)•(N-2)• ..... •3•2•1. And is written as N!. Sometimes we need to find a product of every other or every Kth number from the range (N to 1).. We will denote this as N!! (every other element) or N!!...! (every K-th), where we have ! K times after N.


For K>=2 we can have two different cases:
FIRST, when N is divisible by K then we multiply every K-th number all the way to K, and
SECOND, when N is not divisible by K, then we multiply every K-th number all the way to N mod K.


For example:
3! = 3•2•1;
10!!! = 10•7•4•1.
8!! = 8•6•4•2.


Remark: The tests will be chose so that the result will not be greater than 2000000000.


InputFrom the first line of the standard input, read a number N, (1 <= N <= 100) followed by K exclamation points (!), (1 <= K <= 20).

OutputOutput one integer representing the evaluated expression from the input.

Input:
11!!!
Output:
880

Input:
7!!
Output:
105

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.