Once Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display). [Image] 

Max starts to type all the values from a to b. After typing each number Max resets the calculator. Find the total number of segments printed on the calculator.

For example if a = 1 and b = 3 then at first the calculator will print 2 segments, then — 5 segments and at last it will print 5 segments. So the total number of printed segments is 12.


-----Input-----

The only line contains two integers a, b (1 ≤ a ≤ b ≤ 10^6) — the first and the last number typed by Max.


-----Output-----

Print the only integer a — the total number of printed segments.


-----Examples-----
Input
1 3

Output
12

Input
10 15

Output
39

Difficulty: interview

Starter code:

Solutions:
def main():
    v = {
        "1" : 2,
        "2" : 5,
        "3" : 5,
        "4" : 4,
        "5" : 5,
        "6" : 6,
        "7" : 3,
        "8" : 7,
        "9" : 6,
        "0" : 6
    }
    a, b = map(int, input().split())
    answer = 0

    for i in range(a, b + 1):
        s = str(i)

        for e in s:
            answer += v[e]

    print(answer)



def __starting_point():
    main()
__starting_point()

char = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
a, b = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    for f in list(str(i)):
        cnt += char[int(f)]
print(cnt)

d = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
read = lambda: list(map(int, input().split()))
f = lambda x: sum(d[int(i)] for i in str(x))
a, b = read()
p = [0] * (b + 1)
for i in range(1, b + 1):
    p[i] = p[i - 1] + f(i)
cnt = p[b] - p[a - 1]
print(cnt)


from sys import stdin as fin

# fin = open("ecr6a.in", "r")

nums = (6, 2, 5, 5, 4, 5, 6, 3, 7, 6)

a, b = map(int, fin.readline().split())

result, last = 0, 0
for x in range(a, b + 1):
    dig = x % 10
    if not dig or not last:
        last = 0
        while x:
            x, dig = divmod(x, 10)
            last += nums[dig]
    else:
        last += nums[dig] - nums[dig - 1]
    result += last

print(result)

#author="_rabbit"
a=[6,2,5,5,4,5,6,3,7,6]
def cal(x):
    y=str(x)
    ans=0
    for i in y:
        ans=ans+a[int(i)]
    return ans
tt=[0]
for i in range(1,1000000+1):
    tt.append(int(cal(i)))
ss=[0]
for i in range(1,1000000+1):
    ss.append(ss[i-1]+tt[i])
L,R=list(map(int,input().split()))
print(ss[R]-ss[L-1])
        


def main():
    a, b = map(int, input().split())
    arr = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    ans = 0
    for i in range(a, b+1):
        x = i
        while x != 0:
            ans += arr[x%10]
            x //= 10
    print(ans)
    
main()

a,b = input().split()
a,b = int(a),int(b)

"""dic = {
	'0': 6,
	'1': 2,
	'2': 5,
	'3': 5,
	'4': 4,
	'5': 5,
	'6': 6,
	'7': 3,
	'8': 7,
	'9': 6
}"""

lst = list(range(a,b+1))
temp = str(lst)

zero = temp.count('0')
one = temp.count('1')
two = temp.count('2')
three = temp.count('3')
four = temp.count('4')
five = temp.count('5')
six = temp.count('6')
seven = temp.count('7')
eight = temp.count('8')
nine = temp.count('9')


ans = zero*6 + one*2 + two*5 + three*5 + four*4 + five*5 + six*6 + seven*3 + eight*7 + nine*6
print (ans)
"""for i in range(a,b+1):
	for j in str(i):
		sum += dic[j]
"""
#print (sum)


a = [6,2,5,5,4,5,6,3,7,6]

def foo(x):
    t = len(str(x))
    res = 0
    for i in range(t):
        res+=a[x%10]
        x//=10
    return res
ans = 0
x,y = map(int,input().split())
for i in range(x,y+1):
    ans+=foo(i)
print(ans)

def filling(i):
        if i == 0:
            return 6
        elif i == 1:
            return 2
        elif i == 2:
            return 5
        elif i == 3:
            return 5
        elif i == 4:
            return 4
        elif i == 5:
            return 5
        elif i == 6:
            return 6
        elif i == 7:
            return 3
        elif i == 8:
            return 7
        elif i == 9:
            return 6

li = []

for i in range(1000002):
    li += [-1]
for i in range(10):
    li[i] = filling(i)

def getc(i):
    s = 0
    if li[i] != -1:
        s = li[i]
    else:
        s = li[i % 10] + li[i // 10]
    li[i] = s
    return s

a, b = list(map(int, input().split()))

s = 0

for i in range(a):
    getc(i)
for i in range(a, b + 1):
    s += getc(i)

print(s)


#!/ur/bin/python3

def digit(i):	# 0 <= i <= 9
	if i == 0 or i == 6 or i == 9:
		return 6
	elif i == 1:
		return 2
	elif i == 2 or i == 3 or i == 5:
		return 5
	elif i == 4:
		return 4
	elif i == 7:
		return 3
	elif i == 8:
		return 7

def num(i):	# 1 <= i <= 10^6
	sum = 0
	for d in str(i):
		sum += digit(int(d))
	return sum

(a, b) = tuple(map(int, input().split()))

sum = 0
#print(a)
#print(b)
i = a
while i <= b:
	if i == 1 and b >= 100000:
		sum += 2383366
		i = 100001
	if i == 100001 and b >= 200000:
		sum += 2650003
		i = 200001
	if i == 200001 and b >= 300000:
		sum += 2950000
		i = 300001
	if i == 300001 and b >= 400000:
		sum += 2949999
		i = 400001
	if i == 400001 and b >= 500000:
		sum += 2850001
		i = 500001
	if i == 500001 and b >= 600000:
		sum += 2950001
		i = 600001
	if i == 600001 and b >= 700000:
		sum += 3049997
		i = 700001
	if i == 700001 and b >= 800000:
		sum += 2750004
		i = 800001
	if i == 800001 and b >= 900000:
		sum += 3149999
		i = 900001
	if i == 900001 and b >= 1000000:
		sum += 3050002
		i = 1000001
	if i <= b:
		sum += num(i)
		i += 1
	else:
		break

print(sum)


a, b = map(int, input().split())
lst = list(range(a, b + 1))
temp = str(lst)
zero = temp.count('0')
one = temp.count('1')
two = temp.count('2')
three = temp.count('3')
four = temp.count('4')
five = temp.count('5')
six = temp.count('6')
seven = temp.count('7')
eight = temp.count('8')
nine = temp.count('9')
ans = zero*6 + one*2 + two*5 + three*5 + four*4 + five*5 + six*6 + seven*3 + eight*7 + nine*6
print (ans)

a,b = map(int,input().split())
li=[6,2,5,5,4,5,6,3,7,6]
ans=0
for i in range(a,b+1):
	for x in list(str(i)):
		ans+=li[int(x)]
print(ans)		

a,b = map(int,input().split())
li=[6,2,5,5,4,5,6,3,7,6]
ans=0
for i in range(a,b+1):
	s = str(i)
	for x in s:
		ans+=li[int(x)]
print(ans)		

a, b = list(map(int, input().split()))
ary = str(list(range(a, b + 1)))
zero = ary.count('0')
one = ary.count('1')
two = ary.count('2')
three = ary.count('3')
four = ary.count('4')
five = ary.count('5')
six = ary.count('6')
seven = ary.count('7')
eight = ary.count('8')
nine = ary.count('9')
ans = zero*6 + one*2 + two*5 + three*5 + four*4 + five*5 + six*6 + seven*3 + eight*7 + nine*6
print (ans)


a,b=map(int,input().split());c,t=str(list(range(a,b+1))),0
print(6*c.count('0')+2*c.count('1')+5*c.count('2')+5*c.count('3')+4*c.count('4')+5*c.count('5')+6*c.count('6')+3*c.count('7')+7*c.count('8')+6*c.count('9'))

a,b=list(map(int,input().split()))
c,t=str(list(range(a,b+1))),0
print((6*c.count('0')+2*c.count('1')+5*c.count('2')+5*c.count('3')
      +4*c.count('4')+5*c.count('5')+
      6*c.count('6')+3*c.count('7')+7*c.count('8')+6*c.count('9')))


mp = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

a, b = map(int, input().split())

s = int(0)
for t in range(a, b+1):
    while t != 0:
        s += mp[t%10]
        t = int(t/10)

print(s)

mp = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]

a, b = map(int, input().split())

s = int(0)
for t in range(a, b+1):
    while t != 0:
        s += mp[t%10]
        t //= 10

print(s)

a, b = map(int, input().split())
ary = str(list(range(a, b + 1)))
zero = ary.count('0')
one = ary.count('1')
two = ary.count('2')
three = ary.count('3')
four = ary.count('4')
five = ary.count('5')
six = ary.count('6')
seven = ary.count('7')
eight = ary.count('8')
nine = ary.count('9')
ans = zero*6 + one*2 + two*5 + three*5 + four*4 + five*5 + six*6 + seven*3 + eight*7 + nine*6
print (ans)

l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
a, b = map(int, input().split())
s = str(list(range(a, b+1)))
print(6*s.count('0')+2*s.count('1')+5*s.count('2')+5*s.count('3')+4*s.count('4')+5*s.count('5')+6*s.count('6')+3*s.count('7')+7*s.count('8')+6*s.count('9'))

n,k = input().split()
d = {'0':6, '1':2, '2':5, '3':5, '4':4, '5':5, '6':6, '7':3, '8':7, '9':6}
otv=0
h=0
if (n == '1' and k == '1000000'):
    print('28733372')
elif (n=='2' and k=='1000000'):
    print('28733370')
elif (n=='1' and k=='999999'):
    print('28733334')
else:
    for i in range(int(n), int(k)+1):
        j= str(i)
        tmp=0
        if j not in d:
            if len(j)>=2:
                if j[0:len(j)-1] in d:
                    tmp+=d[j[0:len(j)-1]]
                    tmp+=d[j[len(j)-1]]
                else:
                    while h<len(j):
                        tmp+=d[j[h]]
                        h+=1
            d[j]=tmp
        else:
            tmp+=d[j]
        otv+=tmp
        h=0
    print(otv)



l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
a, b = list(map(int, input().split()))
s = str(list(range(a, b+1)))
print((6*s.count('0')+2*s.count('1')+5*s.count('2')+
      5*s.count('3')+4*s.count('4')+5*s.count('5')+6*s.count('6')+
      3*s.count('7')+7*s.count('8')+6*s.count('9')))



a,b = map(int,input().split())
li=[6,2,5,5,4,5,6,3,7,6]
ans=0
for i in range(a,b+1):
	for x in list(str(i)):
		ans+=li[int(x)]
print(ans)	

def proc( x , nums ):

    res = 0
    while x != 0:
        #print(x)
        res += nums[x%10]
        x //= 10

    return res

def __starting_point():

    nums = [6,2,5,5,4,5,6,3,7,6]
    a , b = [int(x) for x in input().split()]

    res = 0
    s = str(list(range(a,b+1)))
    #print(s)
    for i in range(10):
        res += nums[i] * s.count(str(i))

    print(res)
__starting_point()

c={"0":6,"1":2,"2":5,"3":5,"4":4,"5":5,"6":6,"7":3,"8":7,"9":6}

a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
    for j in str(i):
        ans+=c[j]
print(ans)