Returns value of the dp if already stored
if ( dp [ ( int ) idx , ( int ) tight , ( int ) sum ] != - 1 ) return dp [ ( int ) idx , ( int ) tight , ( int ) sum ] ; long newTight ; long ans = 0 ; long d ;