adding of the space/penalty memoization