Migration of planetesimals from the feeding zone of the terrestrial planets, which was divided into seven regions depending on the distance to the Sun, was simulated. The influence of gravity of all planets was taken into account. In some cases, the embryos of the terrestrial planets rather than the planets themselves were considered; their masses were assumed to be 0.1 or 0.3 of the current masses of the planets. The arrays of orbital elements of migrated planetesimals were used to calculate the probabilities of their collisions with the planets, the Moon, or their embryos. As distinct from the earlier modeling of the evolution of disks of the bodies coagulating in collisions, this approach makes it possible to calculate more accurately the probabilities of collisions of planetesimals with planetary embryos of different masses for some evolution stages. When studying the composition of planetary embryos formed from planetesimals, which initially were at different distances from the Sun, we considered the narrower zones, from which planetesimals came, as compared to those examined earlier, and analyzed the temporal changes in the composition of planetary embryos rather than only the final composition of planets. Based on our calculations, we drew conclusions on the process of accumulation of the terrestrial planets. The embryos of the terrestrial planets, the masses of which did not exceed a tenth of the current planetary masses, accumulated planetesimals mainly from the vicinity of their orbits. When planetesimals fell onto the embryos of the terrestrial planets from the feeding zone of Jupiter and Saturn, these embryos had not yet acquired the current masses of the planets, and the material of this zone (including water and volatiles) could be accumulated in the inner layers of the terrestrial planets and the Moon. For planetesimals which initially were at a distance of 0.7-0.9 AU from the Sun, the probabilities of their infall onto the embryos of the Earth and Venus, the mass of which is 0.3 of the present masses of the planets, differed less than twofold for these embryos. The total mass of planetesimals, which initially were in each part of the region between 0.7 and 1.5 AU from the Sun and collided with the almost-formed Earth and Venus, apparently differed by less than two times for these planets. The inner layers of each of the terrestrial planets were mainly formed from the material located in the vicinity of the orbit of a certain planet. The outer layers of the Earth and Venus could accumulate the same material for these two planets from different parts of the feeding zone of the terrestrial planets. The Earth and Venus could acquire more than half of their masses in 5 Myr. The material ejection that occurred in impacts of bodies with the planets, which was not taken into account in the model, may enlarge the accumulation time for the planets. A relatively rapid growth of the bulk of the Martian mass can be explained by the formation of Mars' embryo (the mass of which is several times less than that of...