A,B = gets.split.map(&:to_i); for i in A..B num = i.to_s if i%3 == 0 print i,"\n" elsif /3/ =~ num print i,"\n" end end