The Daily Mail reports on a study by the Stanford School of Medicine in California which attempts to estimate the direct and indirect costs of gun violence. Obviously, I'm relying on a news report and so cannot comment on the specific methodology used in the study, but I would note that what they are terming "gun violence" includes all gun related injuries, which would, perforce, include injuries resulting from accident or negligence, as well as suicides or attempted suicides.
But there was an interesting point brought out in the article: "shootings of young and poor individuals insured by Medicaid made up about two-thirds of firearm injuries, and they were most often victims of assault." Which suggests that we have a gang problem, not a firearm problem.
In any event, the article indicates that the medical costs are $3.1 billion per year for gun injuries. (To put that in perspective, a 2014 article indicated that car crashes cost the U.S. $871 billion per year; there are an estimated 300 million firearms in the United States, which is probably a low estimate, versus 248 million registered cars. You do the math).
On the other hand, in The Cost of Crime to Society: New Crime-Specific Estimates for Policy and Program Evaluation (Drug Alcohol Depend. 2010 Apr 1; 108(1-2): 98–109), the authors concluded that "[i]n the United States, more than 23 million criminal offenses were committed in 2007, resulting in approximately $15 billion in economic losses to the victims and $179 billion in government expenditures on police protection, judicial and legal activities, and corrections." That comes out to a cost of $8,434 per offense in 2008 dollars (which is year that the study authors used). Thus, even if firearms only prevented 1.6% of crimes (368,000), we would be ahead from a pure cost standpoint. But, actually, firearms are used 2.5 million times per year to stop crimes, or $21 billion worth of crime using the per crime cost listed above. (In reality the cost savings is much greater because firearms are used to prevent more serious--and, thus more costly--crimes). Thus, based on the studies cited to above, the value of firearms for self-defense far exceed the cost of injuries and deaths from firearms.