Charged-particle nuclear modification factors in PbPb and pPb collisions at √sNN=5.02 TeV