a=0 12.times do |m| 30.times do |i| foo = (i+1)/10 bar = (i+1)-foo*10 a+=1 if foo+bar==m+1 end end puts a