Production of Λc+ baryons in proton-proton and lead-lead collisions at sNN=5.02TeV