When a California judge ruled earlier this month that a lawsuit brought by Uber drivers could go forward as class-action, it re-opened the biggest question about the hottest company in Unicornland: Is its business model legal? And if not, can Uber survive?

The ruling has also reignited questions about whether the sharing economy, of which Uber is by far the largest participant and its poster boy, is fair to workers. Last week, workers’ advocacy group the National Employment Law Project released a report that equated Uber and other sharing economy companies to “turn of the century sweatshops” because of a lack of employee benefits and protections.

Investors think that Uber will not just survive, but thrive. They have driven Uber’s valuation up to $51 billion, much higher than what Facebook was worth when it was a six-year-old private company. But the recent lawsuits against Uber raise questions about what seemed like its inevitable success.

By now, many people know the debate. Uber currently classifies its drivers as independent contractors, or “1099” workers, rather than (W-2) employees. Uber says its drivers prefer the flexibility of being independent contractors. But that classification also allows Uber to avoid the taxes and insurance and other administrative expenses that companies usually have to pay to have a workforce.

How much would it cost Uber if it was forced to reclassify its drivers as employees, rather than independent contractors? By my calculations, with help from some experts, I crunched the numbers and got an answer, and it’s a huge amount: $4.1 billion.

uber-costs

Uber declined to comment on my calculations. A spokesperson for the company said it’s difficult to know what additional costs Uber would have to pay if it were required to turn all of its drivers into employees because doing so would force the company to completely change its business model, which is exactly the point.

The California lawsuit was brought by four former drivers who think they deserve the status of employees and reimbursement of their driving expenses. But by certifying it as a class action, the judge said the eventual ruling in the case will apply to all of Uber’s California drivers, excluding only those who had specifically waved their right to participate in the current suit. Uber is fighting the lawsuit, as it has other efforts to force the company to put its drivers on its books. On Tuesday, Uber filed an appeal in the California case, asking the court to reverse the class action status.

MORE: Uber: An Oral History

Uber critics say the real reason Uber has opposed the shift is that it can’t afford it. Miriam Cherry, a St. Louis University law professor who has long followed the sharing economy, says Uber’s current business model is one part technology company and one part labor law workaround. The question is which part is bigger.

To figure that out, I spent the past two weeks digging into Uber’s finances, employment law, and payroll realities. I enlisted the help of experts from two companies that specialize in payroll costs, Paychex and StaffOne. I also talked to SherpaShare, a third party application that helps ride-share drivers track their work, for data on the size and composition of Uber’s workforce, which SherpaShare estimates at around 200,000 drivers. (Uber says it has 160,000 drivers, but those numbers were from the beginning of this year.)

To get the $4.1 billion figure, I started at the top. Uber’s recently leaked numbers—the company is private, so it doesn’t disclose its financials, but some have emerged—put the company’s expected sales this year at about $10 billion. Uber splits what passengers pay 80-20. Uber takes a 20% cut for allowing drivers to use its platform. The rest, $8 billion, is what the drivers get, which would be their salaries if they were employees, though Uber currently does not include that figure in its finances.

Two caveats: Uber has licensing deals for its technology with other companies, and those deals may be contributing to its $2 billion in revenue. So I may be overstating driver salaries by a bit—but not by much. And, just to clarify, my calculations are based on what it would hypothetically cost Uber if it had to hire all of its drivers as employees. But even a legal loss in California won’t automatically mean it will have to change the status of all of its drivers, though it will add to the pressure on the company to do so.

MORE: Uber banks on world domination

Let’s move on. As 1099 workers, Uber drivers are responsible for paying all of their payroll taxes. If they were employees, Uber would have to split those taxes with its employees. Uber’s share: 6.2% of what it pays its drivers for Social Security and another 1.45% for Medicare taxes. And it has to pay those taxes for both its part-time and full-time workers. That would be one of Uber’s largest new costs, totaling $612 million.

The next biggest cost: workers’ compensation insurance. Workers’ comp is regulated by each state, and not all states require it, though most states where Uber is active do. The one exception is Texas—but even there, a worker can demand that his or her employer pay for any work-related injuries, so Uber would be smart to have insurance. Rates vary by state and occupation. Those tend to be relatively high for taxi drivers, and particularly high in California, where about 20% of Uber’s drivers are based, according to estimates by SherpaShare. Total bill: $512 million a year.

Next up, medical insurance. Under Obamacare, employers don’t have to provide medical insurance, but starting next year that decision comes with a $2,000 penalty per employee per year. Paychex says that on average employers spend $5,000 for single employees and $12,000 for family coverage medical insurance. But employers can provide basic medical insurance (and not pay a penalty) for about $3,000 per employee. According to a filing with the federal government, Uber spent $1,275,066 on its healthcare plan, which included prescription drug benefits, for the workers (non-drivers) that it does classify as employees from July 2013 through June 2014. The filing said the plan covered 442 employees, which means it cost $2,885 per employee.

MORE: Meet the woman in charge of Uber’s expansion

The good news for Uber is that companies only have to provide healthcare to full-time employees. Uber says that many of its drivers log less than 10 hours a week, though it’s not clear if Uber is counting just the hours when the drivers have passengers, or total drive time. SherpaShare estimates only about 20% of Uber’s drivers work more than 40 hours a week. (Some might even qualify for overtime, but I haven’t factored that cost in.) Nonetheless, providing medical insurance for its full-time drivers at the same rate that it paid in 2014 for other employees would cost Uber $115 million a year.

NerdWallet, which published an earlier story looking at what Uber drivers stand to gain from becoming employees, said that the company would likely have to provide drivers with nine vacation days, based on what it currently offers its employees. Paychex says providing vacation days and sick leave typically costs employers 6.9% of a workers salary. For Uber, again only for its full-time drivers, that would be another $110 million a year.

Unemployment insurance varies by state. The average of what employers pay in the four states with the most Uber drivers, according to SherpaShare, was $363 per employee. That’s an additional $72 million for Uber a year, plus just over $8 million a year for federal unemployment.

OK, we’re nearly there.

Companies don’t have to provide a retirement plan. But if they do, they have to provide it for all of their full-time employees. According to Glassdoor, Uber has a 401(k) plan for its current employees, and offers a 3% match, meaning it will match its employees’ 401(k) contributions up to 3% of their salary. If all of Uber’s full-time drivers-turned-employees contributed at least that much, that would be another $72 million in costs for Uber.

The last one is a big one: millage reimbursement. Not all states require companies to reimburse their employees for using their personal car for business. But California does. And since that is where Uber is based, there is a good chance that it will have to reimburse all of its employees, not just the ones based in California. Calculating this figure is tricky. Based on survey data from SherpaShare, the average Uber driver, full-time and part-time, puts in nearly 24 hours a week for the ride hailing company. The average speed in cities around the country where Uber is most used appears to be around 20 miles per hour. That means the average Uber driver covers about 475 miles a week. The IRS’s mileage reimbursement rate is 57.5 cents per mile. If Uber were to reimburse its workers at that rate, which it has been ordered to do in some cases, that would be an average of $273.13 a week, or just over $13,000 a year per driver. The total mileage reimbursement bill for Uber: $2.6 billion a year.

MORE: Why I’d never want to compete with Uber’s Travis Kalanick

Add all of those costs up and you get to just over $4.1 billion. Sound too high? I thought so, too. So I had StaffOne’s Donna Meek, a payroll and HR expert, run her own independent calculation. Meek estimated the costs from the bottom up, looking at what it would cost Uber per worker, rather getting the total figures for each cost as I did. Meek’s conclusion: nearly $1.5 billion before the cost of reimbursing drivers for their miles. So pretty close to what I got.

Could Uber afford an additional $4.1 billion in costs a year? Depends on how you measure that. Based on profits, no. Uber, by its own admission, is not profitable. So it really can’t afford its current expenses, let alone another $4 billion. But as Uber has told others, startups aren’t run on profits—they’re run on investors’ money. And they can afford their losses as along as those people are willing to keep funding them.

How long will investors be willing to fund Uber? According to leaked financial statements obtained by Gawker, Uber was on track to lose about $300 million a year, though those losses appeared to be growing. It had about $1.2 billion of cash at the end of June 2014. And it just raised an additional $1 billion this summer. That means Uber will likely have about $1.75 billion in cash in the bank at the end of this year.

Sounds like a lot. But if Uber had to swallow an additional $4 billion in costs, they would need to raise more money by the middle of next year, possibly sooner, or face extinction. And that doesn’t include any money it might have to pay out in damages, or past compensation. Uber could force its workers to take a pay cut. Many of them will be getting new benefits. And Uber would be covering some expenses, like gas and payroll taxes, that its workers are covering now.

But James Kimbrough, who drives about 20 hours a week in Austin as a second job, says that Uber has already cut what its drivers make by nearly a half in the past year in order to attract more customers. Any further reduction in rates—”even just a few more cents,” says Kimbrough—and driving for Uber is probably no longer worth it for him. He believes other drivers would feel the same way. So Uber doesn’t have a lot of wiggle room with the drivers.

At a $51 billion valuation, investors obviously believe that, given enough time, Uber is going to make money, and likely a lot of it. The question is how much longer will that take if the company faces an additional $4 billion in expenses—and are investors prepared to stick around for that long. Uber’s cash meter is running, and it’s running fast.

Subscribe to Data Sheet, Fortune’s daily newsletter on the business of technology, and Power Sheet, on leaders and leadership.

Does Uber have a bad business model? We hash it out in this episode of Fortune Tech Debate: