6709 번 : Jackpot 
 6709 번 
 6709 번 - Jackpot 
 But first an introduction to the game . A slot machine consists of a number of wheels , usually three or four , each with a number of symbols printed on it – cherries , oranges , bells , etc . – and will show one of its symbols at a given time . To play , you insert a coin , push a button and the wheels start spinning . After spinning for a while , each wheel stops – at random it seems – at one of its symbols . If all wheels stop at the same symbol , or some nice combination of symbols , the player wins . One combination that is especially desirable is having the jackpot symbol on all wheels . This combination is simply called ’ jackpot ’ and will make you rich for life . 
 One line with the number of machines n ≤ 20 . For each machine , one line with the number of wheels w ≤ 5 , and one line with w numbers , p 1 , ..., pw the periodicity of each wheel pk ≤ 1000 . 
 One line per machine : The jackpot periodicity of the machine , if it is less than or equal to a billion ( 109 ) , otherwise output the text ’ More than a billion . ’. 
 ACM - ICPC > Regionals > Europe > Northwestern European Regional Contest > Nordic Collegiate Programming Contest > NCPC 2003 E 번