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

#GL0000018. Số khổng lồ kỳ diệu (The Huge One)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Số khổng lồ kỳ diệu (The Huge One)

The Huge One

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given nonnegative decimal integer MM (possibly very long) and a set SS of distinct integers from 11 to 1212, label MM Wonderful if it is divisible by every element of SS, or Simple otherwise. Preserve its decimal spelling.

Input

The first line has MM; the second has kk followed by its kk distinct divisors.

Output

Print M - Wonderful. or M - Simple..

Subtasks

  • Subtask 1 (20 points): 0≤M≤10150 \le M \le 10^{15}; 1≤k≤41 \le k \le 4
  • Subtask 2 (30 points): 0≤M≤101000 \le M \le 10^{100}; 1≤k≤81 \le k \le 8
  • Subtask 3 (50 points): 0≤M≤1010000 \le M \le 10^{1000}; 1≤k≤121 \le k \le 12; Divisors are distinct and lie in the range 1 through 12.

Examples

Input

10
3 1 2 9

Output

10 - Simple.

Explanation

1010 is divisible by 11 and 22 but not 99, so it is Simple.