Text is still unclear... if fireball is passing through the enemy and not loosing its level, so why do 0-level one hit the enemy? this contradicts to statement (fireball can pass through any obstacle except wall)... even more - why in this case 0-level fireball is not hitting us?
In my solution there is a product "width * N" squared, wich in maximum (1000*100)^2 = 10^10 gives more than INT_MAX. I use signed int and I've still got AC, while my program gives -1.#IND on the test 1000 1000 100 1 1 4 5
I suppose you should add boundary tests or soften condition to, for example, "max width and hight <= 100".