Dictionary prefix code to search and return the sum of all matches of the prefix