#C13440. Divisible Array Elements

    ID: 42979 Type: Default 1000ms 256MiB

Divisible Array Elements

Divisible Array Elements

You are given an array of integers and an integer n. Your task is to print all elements of the array that are divisible by n.

Note: If no element in the array is divisible by n, output -1.

Example:

Input:
4
2 4 6 8
2

Output: 2 4 6 8

</p>

In the example above, every element of the array [2, 4, 6, 8] is divisible by 2, so the resulting output is "2 4 6 8".

inputFormat

The input consists of three lines:

  1. The first line contains an integer T representing the number of elements in the array.
  2. If T > 0, the second line contains T space-separated integers denoting the array elements. If T = 0, the second line will be empty.
  3. The third line contains an integer n, the divisor.

outputFormat

If there exists at least one element in the array that is divisible by n, print these elements separated by a single space. Otherwise, print -1.

## sample
4
2 4 6 8
2
2 4 6 8