#CCBCHBON0000009. Sequence of Numbers and Sum (Sequence of Numbers and Sum)

Sequence of Numbers and Sum (Sequence of Numbers and Sum)

Sequence of Numbers and Sum

Source: beecrowd

Version: Phuoc Hung OJ Extended

Problem Statement

Read pairs (M,N)(M,N). For each pair with both values positive, print every integer from min⁡(M,N)\min(M,N) through max⁡(M,N)\max(M,N), then Sum= immediately followed by their total. Stop at the first pair containing a nonpositive value without printing a line for it. Separate sequence terms and the final token with one space.

Input

One pair M,NM,N per line, with the final pair containing a nonpositive value. The PHOJ edition permits up to 50 valid pairs with values in [1,50][1,50]; each terminating value is in [−50,50][-50,50].

Output

One line L L+1 ... R Sum=S per valid pair. Empty output if there are no valid pairs.

Subtasks

  • Subtask 1 (20%): At most 3 valid pairs; valid pair values in [1,50][1,50].

  • Subtask 2 (30%): At most 12 valid pairs; valid pair values in [1,50][1,50].

  • Subtask 3 (50%): At most 50 valid pairs; valid pair values in [1,50][1,50].

Examples

Example 1

Input:

5 2
6 6
0 4

Output:

2 3 4 5 Sum=14
6 Sum=6

Explanation:

Sort each positive pair, print the inclusive sequence and its sum; do not print the sentinel pair.

Example 2

Input:

0 3

Output:


Explanation:

Sort each positive pair, print the inclusive sequence and its sum; do not print the sentinel pair.