hs=Hash.new(2) hs[0]=3 hs[4]=3 hs[6]=3 hs[9]=3 hs[8]=4 ans=1 gets.chomp.chars{|e| ans+=hs[e.to_i] } puts ans