We investigated the reaction dynamics of O(1D) towards hydrogen atoms of two types in HCOOH. The reaction was initiated on irradiation of a flowing mixture of O3 and HCOOD or DCOOH at 248 nm. The relative vibration-rotational populations of OH and OD (1v4, J ≤ 15) states were determined from time-resolved IR emission recorded with a step-scan Fourier-transform spectrometer. In the reaction of O(1D) + HCOOD, the rotational distribution of product OH is nearly Boltzmann, whereas that of OD is bimodal. The product ratio [OH]/[OD] is 0.16 ± 0.05. In the reaction of O(1D) + DCOOH, the rotational distribution of product OH is bimodal, but the observed OD lines are too weak to provide reliable intensities. The three observed OH/OD channels agree with three major channels of production predicted with quantum-chemical calculations. In the case of O(1D) + HCOOD, two intermediates HOC(O)OD and HC(O)OOD are produced in the initial C-H and O-D insertion, respectively. The former undergoes further decomposition of the newly formed OH or the original OD, whereas the latter produces OD via direct decomposition. Decomposition of HOC(O)OD produced OH and OD with similar vibrational excitation, indicating efficient intramolecular vibrational relaxation, IVR. Decomposition of HC(O)OOD produced OD with greater rotational excitation. The predicted [OH]/[OD] ratio is 0.20 for O(1D) + HCOOD and 4.08 for O(1D) + DCOOH; the former agrees satisfactorily with experiments. We also observed the v3 emission from the product CO2. This emission band is deconvoluted into two components corresponding to internal energies E = 317 and 96 kJmol-1 of CO2, predicted to be produced via direct dehydration of HOC(O)OH and secondary decomposition of HC(O)O that was produced via decomposition of HC(O)OOH, respectively.