PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000206. Số ước của đa giai thừa (Multifactorials)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số ước của đa giai thừa (Multifactorials)

Số ước của đa giai thừa (Multifactorials)

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given integer nn and a string of kk exclamation marks !, the order-kk multifactorial equals n(n−k)(n−2k)⋯n(n-k)(n-2k)\cdots, stopping before a nonpositive term. Count its distinct positive divisors. If the count is greater than 101810^{18}, print Infinity; otherwise print the exact count.

Input

One line with integer nn, a space and a string of 1 to 20 ! characters.

Output

Print the exact number of positive divisors, or Infinity.

Subtasks

  • Subtask 1 (20 points): 1≤n≤401\le n\le 40; 1≤k≤51\le k\le 5 (chuỗi gồm kk dấu !).

  • Subtask 2 (30 points): 1≤n≤2001\le n\le 200; 1≤k≤101\le k\le 10 (chuỗi gồm kk dấu !).

  • Subtask 3 (50 points): 1≤n≤10001\le n\le 1000; 1≤k≤201\le k\le 20 (chuỗi gồm kk dấu !).

Examples

Example 1

Input

4 !!

Output

4

Explanation

4!!=4*2=8, which has four positive divisors.

Example 2

Input

6 !!!

Output

6

Explanation

6!!!=6*3=18, which has six positive divisors.

Example 3

Input

5 !

Output

16

Explanation

5!=120=2^335, which has 16 positive divisors.