from, to = gets.split.map(&:to_i) (from..to).each do |i| puts i if i % 3 == 0 || i.to_s =~ /3/ end