The numbers $1, 2, \ldots, 49, 50$ are written on the blackboard. Ann performs the following operation: she chooses three arbitrary numbers $a, b, c$ from the board, replaces them by their sum $a + b + c$, and writes $(a + b)(b + c)(c + a)$ in her notebook. Ann performs such operations until only two numbers remain on the board (in total 24 operations). Then she calculates the sum of all 24 numbers written in the notebook. Let $A$ and $B$ be the maximum and minimum possible sums that Ann can obtain. Find the value of $\frac{A}{B}$.

Let's think step by step and output the final answer within \boxed{}.
user