It´s 20 times the number of energies (including Sp. D) + 10 times the number of Sp. D energies (10 for each Sp. D energies because of it´s effect). So it would be 30x Sp. D energies (max 4) + 20x number of energies (excluding Sp. D). If you have Darkrai LV.X it would be 20 times the number of energies + 10 times the number of D energies (both Sp. D and Basic D) (10 for each D because of its effect -Sp. D- and because of Darkrai´s LV.X effect -Basic D). So it would be 30x D energies (including Sp. D) + 20x number of energies (excluding both Sp. D and Basic D).
With this I mean that Sp. D energies increase the damage (Basic D with Darkrai too) but if you have 1 Sp. D energies the damage won´t be 30x the number of energies but 20 times the number of energies + 10 because of the Sp. D or 20 times the number of energies (excluding Sp. D energies) + 30 times the number of Sp. D energies (as you only have 1, it´s 30).
Note, D=Darkness