For a given debt \(i\) with monthly rate \(r_i = \frac{\text{APR}_i}{12}\) and balance \(B_{i,t}\): Monthly interest: \(I_{i,t} = B_{i,t}\, r_i\) Principal reduction: \(P_{i,t} = \max(0,\ \text{payment}_{i,t} - I_{i,t})\) Next balance: \(B_{i,t+1} = \max(0,\ B_{i,t} + I_{i,t} - \text{payment}_{i,t})\) Strategy order each month: Avalanche: sort debts by \( \text{APR}_i \) descending. Snowball: sort by \( B_{i,t} \) ascending.