Double reverse
Execution time limit is 1 second
Runtime memory usage limit is 122.174 megabytes
Given a sequence of positive integers 1, 2, 3, ..., n. Arrange first in reverse order the part of this sequence starting from the element with number a to the element with number b, and then reverse the subsequence starting from element with number c to the element with number d.
Input
Given the integers n (1 ≤ n ≤ 1000), a, b, c, d (a < b, c < d, 1 ≤ a, b, c, d ≤ 1000)..
Output
Print the resulting sequence.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 11K
Acceptance rate 54%