Motion of solar cosmic rays in the coronal magnetic field