Three- and two-dimensional topological insulators in Pb2Sb2Te5, Pb2Bi2Te5, and Pb2Bi2Se5 layered compounds