add pam algorithm