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

#GL0000050. Kiểm tra chu kỳ sinh số dư (Uniform Generator)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Kiểm tra chu kỳ sinh số dư (Uniform Generator)

Uniform Generator

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Consider x0=0x_0=0 and xi+1=(xi+Step) mod Modx_{i+1}=(x_i+\mathrm{Step})\bmod\mathrm{Mod}. Determine whether this cycle visits all remainders 0,1,…,Mod−10,1,\ldots,\mathrm{Mod}-1 before repetition. Print Good Choice or Bad Choice, using the required numeric column format.

Input

One line contains integers Step\mathrm{Step} and Mod\mathrm{Mod}.

Output

Print Step and Mod right-aligned in fields of width 1010, followed by four spaces and Good Choice or Bad Choice.

Subtasks

  • Subtask 1 (20 points): 1≤Step,Mod≤1001 \le Step,Mod \le 100
  • Subtask 2 (30 points): 1≤Step,Mod≤100001 \le Step,Mod \le 10000
  • Subtask 3 (50 points): 1≤Step,Mod≤1000001 \le Step,Mod \le 100000

Examples

Input

3 5

Output

         3         5    Good Choice

Explanation

For step 33 modulo 55, the cycle is 0,3,1,4,2,0,…0,3,1,4,2,0,\ldots, visiting every remainder.