p- and n-Type doping in carbon modifications