Multilayer diamond-like carbon structures and their boron- and nitrogen-substituted analogs: A quantum-chemical study