## TLE '17 Contest 2 P2 - Unlucky Numbers

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Python 4.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
The bright red buildings and skies of the University of Fireloo.

The University of Fireloo is about to build a new on-campus residence named University of Fireloo Place (UFP), a village with apartment buildings!

Apparently, UFP's architects are quite superstitious, so they believe that the distinct numbers are "unlucky". As a result, for the apartment building, they want the floors to be numbered from to inclusive, but removing all floors with unlucky floor numbers.

Now, the architects need your help to determine how many floors each apartment in UFP should really have.

#### Constraints

For 20% of the points, , and for all and .

For an additional 30% of the points, , and for all and .

#### Input Specification

The first line contains , the number of unlucky numbers the architects have considered.

The second line contains distinct, space-separated positive integers , the unlucky numbers.

The third line contains , the number of apartments to be built in UFP.

For the next lines, the line contains , the top floor number of the apartment. It is guaranteed that no top floor number is an unlucky number.

#### Output Specification

Output lines, where the line contains one integer denoting the actual number of floors the apartment should have.

#### Sample Input

2
4 13
2
16
14

#### Sample Output

14
12