`if` condition should be `if count[:sum]` because Initial value of `count[:num]` is nil.