Texture equation

I don’t know about nVidia extention env_combine4, but I suppose it
isn’t widely supported. So I’ll stay with ARB_texture_env_combine.

I have 4 textures, tex0 to tex3. I have 2 alpha values Alpha1 and
Alpha2, that are > 0 and < 1.

I want to perform this equation :
[tex0.alpha1 + tex1.(1-alpha1)] * [tex2.alpha2 + tex3.(1-alpha2)]

Actually, tex0, tex1, and alpha1 can be considered as an animated
diffuse texture, smoothly blending from one keyframe to another.
tex2, tex3 and alpha2 can be considered as an animated lightmap, again
smoothly blending from one to another.

All must be rendered in 1 pass, on a video card that has 4 texture
units.
I tried a LOT of things, but I can’t figure out what equation I should
assign to each texture unit.