CUDA DP problem #4