puts gets.split.map(&:to_i).map{|i| ret = 0 ret += 4 if i%3==0 ret += 4 if i%5==0 ret = i.to_s.size if ret == 0 ret }.sum