A consensus algorithm in CAT(0) space and its application to distributed fusion of phylogenetic trees