Medical pot cuts pain, study finds