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

#GL0000205. Số mũ lớn nhất chia hết giai thừa (Again Prime? No Time.)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số mũ lớn nhất chia hết giai thừa (Again Prime? No Time.)

Số mũ lớn nhất chia hết giai thừa (Again Prime? No Time.)

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given integers m>1m>1 and n≥1n\ge1, find the largest integer k≥1k\ge1 such that mkm^k divides n!n!. If mm does not divide n!n!, output exactly Impossible to divide. Do not output zero.

Input

One line containing mm and nn, in that order.

Output

Print kk, or Impossible to divide.

Subtasks

  • Subtask 1 (20 points): 2≤m≤1002\le m\le 100; 1≤n≤501\le n\le 50.

  • Subtask 2 (30 points): 2≤m≤10002\le m\le 1000; 1≤n≤10001\le n\le 1000.

  • Subtask 3 (50 points): 2≤m≤49992\le m\le 4999; 1≤n≤99991\le n\le 9999.

Examples

Example 1

Input

2 10

Output

8

Explanation

The exponent of 2 in 10! is 5+2+1=8.

Example 2

Input

4999 2

Output

Impossible to divide

Explanation

4999 does not divide 2!, hence no positive exponent exists.

Example 3

Input

2 100

Output

97

Explanation

The exponent of 2 in 100! is 50+25+12+6+3+1=97.