n = gets.to_i a = [] n.times do a << gets.to_i end b=[nil,0,0,0,1,1,2,4,8,15] if a.max < 10 (a.max-9).times do |i| a << a[9+i]*2 - a[5+i] end end a.each do |i| p b[i] % 17 end