This ended up being trickier than I thought near the end! There's some nice little math puzzles here!
Yes you get it right, Thanks for the review.