Coupling of the magnetic layers and electron spin polarization in four-layer structures of amplitude and nonmagnetic semiconductors