how much did patient 5849 pay in their last hospital encounter for his hospital stay?
select sum(cost.cost) from cost where cost.hadm_id in ( select admissions.hadm_id from admissions where admissions.subject_id = 5849 and admissions.dischtime is not null order by admissions.admittime desc limit 1 )