Soup emptying probability

Write codeHard35 minCitadel style

Your task

There are two soups, A and B, each starting with n ml. On each turn one of four operations is chosen uniformly at random: serve (100,0), (75,25), (50,50), or (25,75) ml from (A,B); if a soup has less than the requested amount, serve all that remains. Operations continue until at least one soup is empty. Return the probability that soup A empties first, plus half the probability they empty simultaneously, rounded to 5 decimal places. 0 <= n <= 10^9.

Examples

soup_servings(n: int) -> float
Example 1
Inputsoup_servings(50)
Output0.625