Add a non-bruteforce solution to the problem 70