Function to generate the dp array
function precompute ( ) { let dp = new Array ( maxn ) ; let arr = [ 4 , 6 , 9 ] ; for ( let i = 0 ; i < maxn ; i ++ ) dp [ i ] = - 1 ; dp [ 0 ] = 0 ; for ( let i = 1 ; i < maxn ; ++ i ) {