The first-principles calculations of the electronic structure of the surfaces of pure metals and layers adsorbed on their surfaces