Children’s allergies to peanuts, dairy and other foods cost the U.S. nearly $25 billion a year, according to the first survey to come up with a comprehensive price tag for a condition that affects 8% of American kids.

Researchers led by Dr. Ruchi Gupta, a pediatrician at Ann & Robert H. Lurie Children's Hospital of Chicago and a professor at Northwestern University's Feinberg School of Medicine, surveyed 1,643 parents around the country who have at least one child with a food allergy. The parents’ responses were weighted to match the actual distribution of children with food allergies in the United States.

Here's what they found:

Doctor’s appointments, hospital stays, trips to the emergency room and other direct medical expenses accounted for $4.3 billion of the tab, researchers reported. The lost productivity of parents who had to take their children to these appointments added $773 million.

Then there were the expenses associated with buying special allergen-free foods, placing children in allergy-sensitive schools and making special arrangements for child care in facilities that are willing to banish peanuts. These costs totaled $5.5 billion.

The biggest cost by far was the money parents gave up by staying out of the workforce, taking lesser jobs or otherwise restricting their careers to accommodate their children’s medical condition. Among the parents surveyed, 9.1% said they had incurred some type of work-related opportunity cost. (Some parents even said they’d been fired as a result of dealing with their kids’ allergies.) Altogether, these costs added up to $14 billion a year.

The grand total for these expenses came to $24.8 billion a year, or $4,184 per child, the researchers found. After excluding medical expenses that would be covered by health insurance, the costs borne by families was $20.5 billion.

To make sure their number was in the ballpark, the researchers asked parents to consider this hypothetical question: How much would you pay each month for a medicine that would cure your child’s allergy? The average response, annualized, was $3,504.

When extrapolated across every single kid with a food allergy in the entire country, the parents’ total willingness to pay to be rid of allergies was $20.8 billion per year. That was surprisingly close to the $20.5 billion per year that food allergies actually cost them, and seemed to validate the high price parents pay in their careers (or lack thereof).

Parents “often need to be at school, social events, or camp to educate and affirm the seriousness of their child’s condition,” the researchers noted in their report, which was published online Monday in the journal JAMA Pediatrics. “In case of an emergency, caregivers may not be able or willing to take a job that requires travel or many hours away from their child.”