An ab initio study of interactions of carbon monoxide and metal electrodes