Seven Segment Scrolling Sandbox Post

Intro

The information panels are everywhere. When the technology became cheaper, the paper posters were transformed into luminous signs that show words that appear on one side and come out on the other, like the one on the figure:



When one of these signs starts up, it usually starts empty and the text leaves from the right side to the left, moving until it disappears.

Its functionality is to go on and off the small light bulbs (LEDs) to give the sensation of movement.

If instead of text we only need to show numbers, the poster can be much less sophisticated using the so-called seven-segment markers like the following:



In this case each number is represented by the combination on / off of only 7 light segments that allow to represent all the numbers:



The question we ask ourselves is how many changes of lights (how many on and off) should be made to pass through one of these posters a certain number?

For example, to show the 123 in a 3-digit sign that starts with all the LEDs off we will have:



This makes a total of 42 changes of lights. 



Challenge

Given a non-negative number and a positive sign length calculate the number of lights changes.

Rules


Assume input consist in a non-negative number (N >= 0) and a positive sign length (M > 0)
Assume Sign length >= Number length (M >= digits(N))


Test cases

123, 3        =&gt; 42
45, 5         =&gt; 60
111, 3        =&gt; 12
98765, 10     =&gt; 220
0, 3          =&gt; 36
Python 2, 129 126 119 104 bytes



def f(n,k,p=0):z=p&lt;1or n&gt;0;q=-~ord('}/lx2Z^o~z'[n%10])*z;return(z and f(n/10,k,q))+k*bin(p^q).count('1')


Try it online!

Thx for a big 15 bytes from ovs.

As specified, takes a non-negative number and a positive sign length, and returns total changes.