input = gets.split(" ") input.map! do |i| i.to_i end count = 0 input.each do |j| if j % 15 == 0 count += 8 elsif j % 3 == 0 || j % 5 == 0 count += 4 else count += j.to_s.length end end puts count