13191 - GEC1506-Ignore multiples (II)   

Description

Given a boundary with numbers and several condition numbers,

generate a list of numbers within the given boundary, but without the multiples of condition numbers.

Input

The input consists of two lines as two parts with the following syntax:

0,20

3,5,7

  1. The first line is two boundary numbers which indicates the lower bound is 0 and the upper bound is 20.
  2. The second line is multiple constrained numbers which are 3, 5 and 7.
  3. All the numbers are integers.

 

With the input, you need to generate a list of integers within the boundary of 0 and 20. (20 is excluded!)

Note that the generated list MUST avoid all the multiples of the constrained numbers which are 3, 5 and 7 (e.x. 0, 3, 5, 6, 7, 9 ... should be avoided as they are the multiples of 3, 5 OR 7)

Output

The output is the generated list that formated with a "comma" between each element.

Note that the output list of numbers should be in ascending order.

Sample Input  Download

Sample Output  Download

Tags




Discuss