Core Idea
Let dp[s] be the number of ways to form sum s using the coin types processed so far.
Algorithm
Initialize dp[0] = 1. For each coin, scan sums upward and add dp[s - coin] into dp[s].
Common Mistakes
Processing coins in the outer loop counts combinations, not permutations. If the answer is modulo a number, apply the modulo after every addition.