  Strong electron correlations are responsible both for the insulator ground
state of undoped La$_2$CuO$_4$ and strong antiferromagnetic coupling $J$
between neighbouring spins. We consider magnetic mechanism of superconducting
pairing in the effective low energy $t - t' - t" - J^*$ model with all
parameters calculated {\it ab initio}. Interaction of strongly correlated
electrons with different phonon modes is also incorporated. In a BCS type
theory the $d_{x^2 - y^2}$ gap is given by a sum of magnetic and phonon
contributions. The phonon coupling parameter $\lambda = f(x)G$, where $G$ is a
combination of bare electron-phonon couplings for all modes and the function
$f$ depends on the hole concentration $x$ due to strong electron correlations.
The main contribution to the only fitting parameter $G$ is determined by a
competition of the breathing and buckling modes. Fitting the parameter $G$ from
the isotope effect we obtain that magnetic and phonon contributions to the
critical temperature $T_c $ work together and are of the same order of
magnitude.
