Thermochemistry of cometary nuclei. 1: The Jupiter family case