Finished the hard part of DP187Easy

I should really do some cleaning and stuff, refactor things so they're
easier to read. But I can do that in a minute.