I say 4. Hitting the black in this case, in itself, is not a foul, even though the cue went in after hitting it. The value of the black is only considered if the act of hitting it is a foul, such as when red is 'on', but you hit the black first. Or if you potted a red and then the black was also potted by the same shot.
So for this kind of infraction, the amount of penalty points equals the value of the 'on' ball, or 4, whichever is higher. As a red is worth 1, the amount of penalty points will be the default 4.