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

#SP0000012. Những chữ số trong ký ức (Scenes From a Memory)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Những chữ số trong ký ức (Scenes From a Memory)

Scenes From a Memory

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

During a hypnosis session, Nicholas recalled a positive integer with kk decimal digits and no zero digits. He may delete any digits while preserving the relative order of those kept, but must keep at least one digit. He wants the remaining integer to be non-prime (equal to 11 or composite), and wishes to delete as many digits as possible. If several shortest valid remaining sequences exist, print any of them. At least one valid sequence is guaranteed.

Input

The first line contains integer kk, the number of digits in nn. The second line contains the kk-digit string nn, consisting only of digits 1 through 9.

Output

Print two lines. The first contains integer rr, the minimum number of retained digits. The second contains the retained sequence of exactly rr digits, in their original order, representing a non-prime integer.

Subtasks

  • Subtask 1 (20 points): 1≤k≤21\le k\le 2, ∣n∣=k|n|=k; all digits of nn belong to {1,2,…,9}\{1,2,\ldots,9\}; a valid non-prime subsequence exists.
  • Subtask 2 (30 points): 1≤k≤101\le k\le 10, ∣n∣=k|n|=k; all digits of nn belong to {1,2,…,9}\{1,2,\ldots,9\}; a valid non-prime subsequence exists.
  • Subtask 3 (50 points): 1≤k≤501\le k\le 50, ∣n∣=k|n|=k; all digits of nn belong to {1,2,…,9}\{1,2,\ldots,9\}; a valid non-prime subsequence exists.

Examples

Input

3
237

Output

2
27

Explanation

For 237, keeping one digit yields only 22, 33 or 77, all prime, so r=1r=1 is impossible. Keeping 2 and 7 gives 27=3⋅927=3\cdot9, which is composite. Thus r=2r=2 is optimal.

Input

5
44444

Output

1
4

Explanation

Keeping a single digit 4 gives a composite number. Since at least one digit must remain, r=1r=1 is optimal.

Input

2
35

Output

2
35

Explanation

Each one-digit subsequence (33 or 55) is prime. Keeping both produces 35=5⋅735=5\cdot7, which is composite, so the answer has length 22.