Under construction

Still being built. Things may change

Mult!

Interview

Time limit1sMemory limit1024 MB

Summary
Scan a sequence of numbers and print each number that is a multiple of the first number of its current round, which then restarts the round.
Level

Easy3 of 10

Topics
Implementation, Simulation, Math, Array
Solved
No attempts yet

Problem

Nora Mainder plays a game with her students to help them learn multiplication. She calls out a sequence of numbers, and the students must determine when she names a whole number multiple of the first number. When a student recognizes such a multiple, they must call out "Mult!", which ends the round. A new round then begins with a new initial number. Her students are very bright and never fail to spot a multiple, so they all shout at once: a "multitude" of shouts.

For example, if she calls out "88, 33, 1212, 66, 2424," the students all yell "Mult!" when she reaches 2424, because it is a multiple of the first number, 88. If she begins a second round with the sequence "1414, 1212, 99, 7070," the class calls out "Mult!" when she reaches 7070, a multiple of the first number, 1414.

Given a sequence of numbers called out by Nora over several rounds of the game, identify every number that should produce a shout of "Mult!"

Input

The first line of input contains an integer nn, 2≤n≤1 0002 ≤ n ≤ 1\,000, the length of the number sequence. The following nn lines contain the sequence, one number per line. All numbers in the sequence are positive integers less than or equal to 100100. The sequence contains at least one complete round of the game, but it may end with an incomplete round.

Output

Print every element of the sequence that causes the class to shout "Mult!". Print each value on its own line.

Examples2

  1. Example 1

    Input
    10
    8
    3
    12
    6
    24
    14
    12
    9
    70
    5
    
    Expected output
    24
    70
    
  2. Example 2

    Input
    5
    3
    3
    2
    5
    7
    
    Expected output
    3