Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 3889
Making Sequence

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Recently, Bob learned the properties of the difference operator Δ, defined by Δf(x) = f(x + 1) - f(x).

Now, Bob wants you to construct a sequence S of s integers which satisfies the following properties:

  1. ∀ 1 ≤ is, 1 ≤ S(i) ≤ n.
  2. ∀ 1 ≤ i, js, ij, S(i) ≠ S(j).
  3. ∀ 0 ≤ ia, 1 ≤ j < |Si|, Si(j) < Si(j + 1), where Si = ΔSi - 1, S0 = S.

Bob also wants you to construct another sequence T of t integers which satisfies the following properties:

  1. ∀ 1 ≤ it, 1 ≤ T(i) ≤ n.
  2. ∀ 1 ≤ i, jt, ij, T(i) ≠ T(j).
  3. ∀ 0 ≤ ib, 1 ≤ j < |Ti|, Ti(j) > Ti(j + 1), where Ti = ΔTi - 1, T0 = T.

Now, you are given n, a, b, s, t, please construct the two sequence S and T for Bob.

Notice:

  1. |S| indicates the length of the sequence S.
  2. ΔS indicates the difference operation on sequence S and |ΔS| = |S| - 1

Input

Input will consist of multiple test cases. Each case contains one line with five integers n, a, b, s, t (1 ≤ n < 264, 1 ≤ s, t ≤ 100, 0 ≤ a, b ≤ 10, a < s, b < t), separated by spaces.

Output

For each cases, output two lines.

In the first line, if you find the sequence, output s integers S(1), S(2), ..., S(s), separated by one space. Otherwise just output "-1". If there are multiple sequences meeting the conditions, you should output the lexicographically smallest one.

In the second line, if you find the sequence, output t integers T(1), T(2), ..., T(t), separated by one space. Otherwise just output "-1". If there are multiple sequences meeting the conditions, you should output the lexicographically largest one.

Please print a blank line between cases.

Sample Input

5 0 0 3 2
5 1 0 4 2

Sample Output

1 2 3
5 4

-1
5 4

Author: LIN, Xi
Source: ZOJ Monthly, July 2015
Submit    Status