USACO beads using dynamic programming