Python 2, 129 126 111 bytes
def f(n,k,p=0):q=int('7367355777e0d93bf0fb'[n%10::10],16)*(n>0);return(n and f(n/10,k,q))+k*bin(p^q).count('1')
def f(n,k,p=0):q=int('7367355777e0d93bf0fb'[n%10::10],16)*(n>0);return(n and f(n/10,k,q))+k*bin(p^q).count('1')