[math-fun] A + B + C = D and A, B, C substrings of D