Solved Problem 6.

I again just brute forced this one when there's definitely a more formula-based approach. I was able to just beat this with a stick, though, and things worked totally fine.