Calculate MAP