a,b=gets.chomp.split.map(&:to_i) (a..b).each do |i| if i%3==0 puts i elsif i.to_s.include?(3) puts i end end