Under construction

Still being built. Things may change

Water Journal

Interview

Time limit1sMemory limit2048 MB

Summary
Given n-1 logged daily water amounts and the true minimum a and maximum b, list every value the missing day could have, or -1 if none fits.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

Every day, Eugene logs how many cups of water he drank. He forgot to log one entry in his journal, but he remembers the minimum and maximum number of cups of water he drank on any day since he started logging, and that there was at least one day where he drank the minimum and at least one day where he drank the maximum. Compute all possible amounts of cups of water he could have drunk on the day he forgot to log.

Input

The first line contains three integers nn (2≤n≤502 \le n \le 50), aa, and bb (1≤a≤b≤501 \le a \le b \le 50), where nn is the number of days in Eugene's log, aa is the minimum number of cups of water he drank on any day, and bb is the maximum.

Each of the next n−1n-1 lines contains a single integer ww (a≤w≤ba \le w \le b). These are the entries in Eugene's log for every day except the day he forgot to log.

Output

Output all possible values for the missing entry in increasing order, separated by whitespace, or output -1 if Eugene's memory is faulty and no value is possible.

Examples2

  1. Example 1

    Input
    5 1 5
    1
    2
    4
    5
    
    Expected output
    1
    2
    3
    4
    5
    
  2. Example 2

    Input
    5 1 5
    1
    2
    3
    4
    
    Expected output
    5