101 accepted

Not the cleanest code but it gets the right answer so I guess that's
enough.