dp for perm