A search is presented for the decays of heavy exotic long-lived particles (LLPs) that are produced in proton-proton collisions at a center-of-mass energy of 13TeV at the CERN LHC and come to rest in the CMS detector. Their decays would be visible during periods of time well separated from proton-proton collisions. Two decay scenarios of stopped LLPs are explored: a hadronic decay detected in the calorimeter and a decay into muons detected in the muon system. The calorimeter (muon) search covers a period of sensitivity totaling 721 (744) hours in 38.6 (39.0) fb(-1) of data collected by the CMS detector in 2015 and 2016. The results are interpreted in several scenarios that predict LLPs. Production cross section limits are set as a function of the mean proper lifetime and the mass of the LLPs, for lifetimes between 100 ns and 10 days. These are the most stringent limits to date on the mass of hadronically decaying stopped LLPs, and this is the fi rst search at the LHC for stopped LLPs that decay to muons.