#CCBCHBAHAI0000118. Array Mastery II - Source & Semantics Clinic

Array Mastery II - Source & Semantics Clinic

Array Mastery II - Source & Semantics Clinic

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given A=(a0,…,an−1)A=(a_0,\ldots,a_{n-1}) and x,yx,y, perform a final chapter clinic: report inferred size and last valid index; copy AA independently; report UNKNOWN for attempting to recover original length from a function parameter int a[] via sizeof; find first/last index and frequency of xx; reverse-copy the array; replace all xx by yy and count activated replacements; finally compute the minimum number of +1 moves needed to make the replaced array nondecreasing.

Input

Read nn, the array, then x,yx,y.

Output

Print the 9 lines specified by the Vietnamese statement: size/last index, copy, UNKNOWN, first/last, frequency, reverse, replacement count, replaced array, and minimum repair moves.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le10, magnitudes at most 100.

Subtask 2 (30 points): 1≤n≤10001\le n\le1000, magnitudes at most 10610^6.

Subtask 3 (50 points): 1≤n≤1051\le n\le10^5, magnitudes at most 10910^9.

Example

Input

5
3 1 3 2 3
3 4

Output

5 4
3 1 3 2 3
UNKNOWN
0 4
3
3 2 3 1 3
3
4 1 4 2 4
5

Explanation

After replacing 3 by 4, the array is (4,1,4,2,4); 3+2=5 increments are necessary.