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: EASY
Tags: Implementation

Starter code:

Solutions:
count = '6255456376'
(a, b) = list(map(int, input().split()))
res = ''.join(map(str, range(a, b + 1)))
s = 0
for i in range(10):
	s += res.count(str(i)) * int(count[i])
print(s)


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


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


import sys
digits = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
inp = sys.stdin.readline().split(' ')
start = int(inp[0])
stop = int(inp[1])
total = 0
i = start
while i <= stop:
	d = i
	while d != 0:
		total += digits[d % 10]
		d //= 10
	i = i + 1
print(total)


(a, b) = map(int, input().split())
d = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
ans = 0
for i in range(a, b + 1):
	for c in str(i):
		ans += d[c]
print(ans)


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


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'))


m = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
(a, b) = list(map(int, input().split()))
s = 0
for i in range(a, b + 1):
	for j in str(i):
		s += m[j]
print(s)


(A, B) = map(int, input().split())
D = [0 for _ in range(10)]
S = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for n in range(A, B + 1):
	for s in str(n):
		D[int(s)] += 1
res = 0
for i in range(10):
	res += D[i] * S[i]
print(res)


(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'))


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


(a, b) = map(int, input().split())
segments = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
count_1_to_1000000 = 28733372
count = 0
if b - a + 1 < 10 ** 6 / 2:
	s = str(list(range(a, b + 1)))
	for i in range(10):
		count += s.count(str(i)) * segments[i]
else:
	s = str(list(range(1, a)))
	s += str(list(range(b + 1, 10 ** 6 + 1)))
	for i in range(10):
		count += s.count(str(i)) * segments[i]
	count = count_1_to_1000000 - count
print(count)


from itertools import accumulate
D = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
P = list(accumulate([0] + D))
s = P[-1]

def radix_sum(c, k, first):
	return int((c - first) * k * s * 10 ** (k - 1) + (P[c] - 6 if first else P[c]) * 10 ** k)

def total_sum(k):
	return sum((radix_sum(10, i, True) for i in range(k)))

def prefix_sum(n):
	digits = [int(x) for x in n]
	l = len(digits)
	a = sum((D[digits[i]] * (int(n[i + 1:]) + 1) for i in range(l - 1))) + D[digits[-1]]
	return a + sum((radix_sum(c, l - 1 - i, i == 0) for (i, c) in enumerate(digits))) + total_sum(l - 1)
(a, b) = input().split()
print(prefix_sum(b) - prefix_sum(str(int(a) - 1)))


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)


(a, b) = list(map(int, input().split()))
d = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
cem = 0
for i in range(a, b + 1):
	while i > 0:
		cem += d[i % 10]
		i //= 10
print(cem)


def solve():
	li = {'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())
	res = 0
	b += 1
	for i in range(a, b):
		s = str(i)
		for e in s:
			res += li[e]
	print(res)
solve()


(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())
cost = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
ans = 0
for i in range(a, b + 1):
	while i:
		digit = i % 10
		ans += cost[digit]
		i = i // 10
print(ans)


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())
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)


f = lambda : map(int, input().split())
a = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
sm = 0
(x, y) = f()
s = str(list(range(x, y + 1)))
for i in range(10):
	sm += s.count(str(i)) * a[i]
print(sm)


import sys
from bisect import bisect_right as rb
from collections import deque
from queue import PriorityQueue
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
(a, b) = il()
ans = 0
c = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for i in range(a, b + 1):
	j = i
	while j:
		ans += c[j % 10]
		j = j // 10
print(ans)


(a, b) = map(int, input().split())
act = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
r = 0
for i in range(a, b + 1):
	r += sum((act[ord(c) - ord('0')] for c in str(i)))
print(r)


from math import *
d = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
(l, r) = map(int, input().split())
ans = 0

def calc(a):
	res = 0
	while a > 0:
		res += d[a % 10]
		a //= 10
	return res
for a in range(l, r + 1):
	ans += calc(a)
print(ans)


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

def ans(n):
	res = 0
	while n:
		res += dig[n % 10]
		n //= 10
	return res
(a, b) = map(int, input().split())
final = 0
for j in range(a, b + 1):
	final += ans(j)
print(final)


__author__ = 'Admin'
(a, b) = map(int, input().split())
m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
ans = 0
for i in range(a, b + 1):
	s = str(i)
	for j in range(len(s)):
		ans += m[int(s[j])]
print(ans)


s = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
total = 0
(a, b) = map(int, input().split())
for i in range(a, b + 1):
	if i < 10:
		total += s[i]
	else:
		j = str(i)
		sum = 0
		for i in j:
			sum += s[int(i)]
		total += sum
print(total)


sigment = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
ans = 0
(l, r) = map(int, input().split())
for i in range(l, r + 1):
	for j in str(i):
		k = j
		ans += sigment[k]
print(ans)


d = list([6, 2, 5, 5, 4, 5, 6, 3, 7, 6])
(a, b) = map(int, input().split())
nums = str(list(range(a, b + 1)))
r = 0
for i in range(len(d)):
	r += d[i] * nums.count(str(i))
print(r)


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])


dic = {'1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6, '0': 6}
(l, r) = map(int, input().strip().split())
ans = 0
for i in range(l, r + 1):
	s = str(i)
	for x in range(0, len(s)):
		ans += dic[s[x]]
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) = 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)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
(a, b) = MAP()
d = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
sm = 0
for i in range(a, b + 1):
	for j in str(i):
		sm += d[j]
print(sm)


(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)


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


(a, b) = map(int, input().split())
v = []
sum = 0
for i in range(a, b + 1):
	s = str(i)
	for j in range(0, len(s)):
		if s[j] == '0':
			sum += 6
		if s[j] == '1':
			sum += 2
		if s[j] == '2':
			sum += 5
		if s[j] == '3':
			sum += 5
		if s[j] == '4':
			sum += 4
		if s[j] == '5':
			sum += 5
		if s[j] == '6':
			sum += 6
		if s[j] == '7':
			sum += 3
		if s[j] == '8':
			sum += 7
		if s[j] == '9':
			sum += 6
print(sum)


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


(a, b) = map(int, input().split())
if a == 1 and b == 1000000:
	print(28733372)
	exit()
if a == 2 and b == 1000000:
	print(28733370)
	exit()
if a == 1 and b == 999999:
	print(28733334)
	exit()
v = 0
for i in range(a, b + 1):
	cur = str(i)
	for j in cur:
		if j == '0':
			v += 6
		elif j == '1':
			v += 2
		elif j == '2':
			v += 5
		elif j == '3':
			v += 5
		elif j == '4':
			v += 4
		elif j == '5':
			v += 5
		elif j == '6':
			v += 6
		elif j == '7':
			v += 3
		elif j == '8':
			v += 7
		elif j == '9':
			v += 6
print(v)


inp = input().split()
a = int(inp[0])
b = int(inp[1])
r = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
sr = [0 for x in range(0, 10)]
sr[0] = r[0]
for i in range(1, 10):
	sr[i] += sr[i - 1] + r[i]
s = 49
ac = 0
bc = 0
k = 1
na = 0
nb = 0
ta = a
while a != 0:
	ac += sr[a % 10] * k - r[a % 10] * (k - na - 1)
	na += k * (a % 10)
	a = int(a / 10)
	ac += (a * s - r[0]) * k
	k *= 10
k = 1
while b != 0:
	bc += sr[b % 10] * k - r[b % 10] * (k - nb - 1)
	nb += k * (b % 10)
	b = int(b / 10)
	bc += (b * s - r[0]) * k
	k *= 10
ma = 0
while ta != 0:
	ma += r[ta % 10]
	ta = int(ta / 10)
print(bc - ac + ma)


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


(a, b) = map(int, input().split())
count = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
next_sum = [49, 43, 41, 36, 31, 27, 22, 16, 13, 6]
prev_sum = [6, 8, 13, 18, 22, 27, 33, 36, 43, 49]
segments = 0
p = 1
(a_orig, b_orig) = (a, b)
a_not_end = True
while a or b:
	(a_div, a_mod) = divmod(a, 10)
	(b_div, b_mod) = divmod(b, 10)
	(a_orig_mod, b_orig_mod) = (a_orig % p, b_orig % p)
	segments += (prev_sum[b_mod] - count[b_mod]) * p + (b_orig_mod + 1) * count[b_mod]
	if a_not_end:
		if b_div > a_div:
			segments += (next_sum[0] * (b_div - a_div - 1) + next_sum[a_mod]) * p
			segments -= a_orig_mod * count[a_mod]
		elif a_mod:
			segments -= prev_sum[a_mod - 1] * p
			segments -= a_orig_mod * count[a_mod]
	elif b_div:
		segments += (next_sum[0] * (b_div - 1) + next_sum[1]) * p
	else:
		segments -= count[0] * p
	(a, b) = (a_div, b_div)
	if a == 0:
		a_not_end = False
	p *= 10
print(segments)


segment = {'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
s = str([i for i in range(a, b + 1)])
for i in s:
	try:
		ans += segment[i]
	except:
		pass
print(ans)


import math
import os
import random
import re
import sys
import functools
from operator import itemgetter, attrgetter
from collections import Counter
Y = lambda : list(map(int, input().split()))
P = lambda : map(int, input().split())
N = lambda : int(input())
(a, b) = P()
(cnt, l) = (0, [6, 2, 5, 5, 4, 5, 6, 3, 7, 6])
n = str(list(range(a, b + 1)))
for i in range(10):
	cnt += l[i] * n.count(str(i))
print(cnt)


(a, b) = [int(x) for x in input().split()]
d = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
dzerosinrange = {10: 9, 100: 180, 1000: 2700, 10000: 36000, 100000: 450000}
answer = 0
i = a
while i <= b:
	if i in dzerosinrange and i * 10 - 1 <= b:
		answer += 6 * dzerosinrange[i]
		for digit in range(1, 10):
			answer += d[digit] * (i + dzerosinrange[i])
		i = i * 10
	else:
		test = i
		while test > 0:
			digit = test % 10
			answer += d[digit]
			test = test // 10
		i = i + 1
print(answer)


seg = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
count = 0
(a, b) = map(int, input().split())
for i in range(a, b + 1):
	ele = str(i)
	for j in ele:
		count += seg[int(j)]
print(count)


import sys, math

def cal(a, b):
	seg = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
	ans = 0
	for i in range(a, b + 1):
		for c in str(i):
			ans += seg[int(c)]
	return ans
(a, b) = map(int, input().split())
print(cal(a, b))


s = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
(a, b) = map(int, input().split())
t = ''.join(map(str, range(a, b + 1)))
print(sum((s[d] * t.count(str(d)) for d in range(10))))


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


def digit(i):
	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):
	sum = 0
	for d in str(i):
		sum += digit(int(d))
	return sum
(a, b) = tuple(map(int, input().split()))
sum = 0
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)


def proc(x, nums):
	res = 0
	while x != 0:
		res += nums[x % 10]
		x //= 10
	return res
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)))
for i in range(10):
	res += nums[i] * s.count(str(i))
print(res)


(a, b) = map(int, input().split())
count = 0
d = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
for i in range(a, b + 1):
	l = 0
	k = str(i)
	for j in k:
		count += d[int(j)]
print(count)


(a, b) = map(int, input().split())
l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
sum = 0
for i in range(a, b + 1):
	aa = str(i)
	aa = list(aa)
	for j in range(len(aa)):
		aa[j] = int(aa[j])
	for j in range(len(aa)):
		sum += l[aa[j]]
print(sum)


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)


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


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)
main()


(a, b) = [int(i) for i in input().split()]
n_seg = {}
n_seg[0] = 6
n_seg[1] = 2
n_seg[2] = 5
n_seg[3] = 5
n_seg[4] = 4
n_seg[5] = 5
n_seg[6] = 6
n_seg[7] = 3
n_seg[8] = 7
n_seg[9] = 6
tot_sum = 0
while a <= b:
	n = str(a)
	for i in n:
		tot_sum += n_seg[int(i)]
	a += 1
print(tot_sum)


dig_to_amount = {'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())
result = 0
for i in range(a, b + 1):
	result += sum([dig_to_amount[x] for x in str(i)])
print(result)


(a, b) = map(int, input().split())
z = {'1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6, '0': 6}
s = 0
for i in range(a, b + 1):
	k = str(i)
	for i in k:
		s += z[i]
print(s)


cnt = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
total = sum(cnt)
(a, b) = map(int, input().split())
res = 0
for num in range(a, b + 1):
	for d in str(num):
		res += cnt[int(d)]
print(res)


def main():

	def f(n):
		(l, m) = ([0] * 10, 1)
		while n >= m:
			(headmid, tail) = divmod(n, m)
			(head, mid) = divmod(headmid, 10)
			for i in range(10):
				l[i] += head * m
			if head:
				l[0] -= m
			for i in range(mid):
				if head or i:
					l[i] += m
			if headmid:
				l[mid] += tail + 1
			m *= 10
		return sum((x * y for (x, y) in zip(l, (6, 2, 5, 5, 4, 5, 6, 3, 7, 6))))
	(a, b) = map(int, input().split())
	print(f(b) - f(a - 1))
main()


(a, b) = map(int, input().split())
d = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
cnt = 0
for i in range(a, b + 1):
	for j in str(i):
		cnt += d.get(j)
print(cnt)


N = '6255456376'
(a, b) = map(int, input().split())
s = ''.join(map(str, range(a, b + 1)))
print(sum((int(N[d]) * s.count(str(d)) for d in range(10))))


(a, b) = map(int, input().split())
segments = (6, 2, 5, 5, 4, 5, 6, 3, 7, 6)
ans = 0
for i in range(a, b + 1):
	x = i
	while True:
		digit = x % 10
		ans += segments[digit]
		if x < 10:
			break
		x = x // 10
print(ans)


num = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
x = list(map(int, input().split()))
total = 0
for i in range(x[0], x[1] + 1):
	if i > 9:
		number = i
		while number:
			r = number % 10
			total += num[r]
			number = number // 10
	else:
		total += num[i]
print(total)


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

def count(d):
	v = d
	count = 0
	while v != 0:
		count += digits[v % 10]
		v = v // 10
	return count

def main():
	(s, e) = [int(v) for v in input().split()]
	total = 0
	for i in range(s, e + 1):
		total += count(i)
	print(total)
main()


v = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
p = input()
p = p.split(' ')
answer = 0
for k in range(int(p[0]), int(p[1]) + 1, 1):
	for q in str(k):
		answer += int(v[int(q)])
print(answer)


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
cat = ''.join
catn = '\n'.join
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
(a, b) = ris()
ans = 0
for x in range(a, b + 1):
	while x:
		ans += m[x % 10]
		x //= 10
print(ans)


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


(a, b) = map(int, input().split())
s = 0
n = str(list(range(a, b + 1)))
d = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
for x in range(10):
	s += d[x] * n.count(str(x))
print(s)


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
(a, b) = mints()
c = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
r = 0
aa = (a + 999) // 1000
if aa * 1000 >= b:
	aa -= 1
for i in range(a, aa * 1000):
	while i > 0:
		r += c[i % 10]
		i //= 10
bb = (b - 1) // 1000
if aa == 0:
	aa += 1
z = 0
w = sum(c) * 300
for i in range(aa, bb):
	r += w
	while i > 0:
		z += c[i % 10]
		i //= 10
if aa + 1 < bb:
	for i in range(bb * 1000, b + 1):
		while i > 0:
			r += c[i % 10]
			i //= 10
else:
	z = 0
	r = 0
	for i in range(a, b + 1):
		while i > 0:
			r += c[i % 10]
			i //= 10
print(r + z * 1000)


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

def get_segments(a):
	global m
	s = 0
	while a > 0:
		n = a % 10
		s += m[n]
		a //= 10
	return s
(a, b) = [int(i) for i in input().split()]
s = 0
for i in range(a, b + 1):
	s += get_segments(i)
print(s)


li = {'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())
res = 0
b += 1
for i in range(a, b):
	res += sum([li[e] for e in list(str(i))])
print(res)


def seven_segments(start, end):
	total = 0
	segments = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
	for x in range(start, end + 1):
		for y in str(x):
			total += segments[y]
	return total
(start, end) = list(map(int, input().split()))
print(seven_segments(start, end))


from functools import cmp_to_key
from collections import deque, Counter
from heapq import heappush, heappop
from math import log, ceil
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def ii():
	return int(inp())

def si():
	return str(inp())

def li(lag=0):
	l = list(map(int, inp().split()))
	if lag != 0:
		for i in range(len(l)):
			l[i] += lag
	return l

def mi(lag=0):
	matrix = list()
	for i in range(n):
		matrix.append(li(lag))
	return matrix

def lsi():
	return list(map(str, inp().split()))

def print_list(lista, space=' '):
	print(space.join(map(str, lista)))

def bisect_left(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] < x:
			left = mid + 1
		else:
			right = mid
	return left

def bisect_right(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] > x:
			right = mid
		else:
			left = mid + 1
	return left

def bisect_elements(a, x):
	return bisect_right(a, x) - bisect_left(a, x)
MOD = 10 ** 9 + 7
maxN = 5
FACT = [0] * maxN
INV_FACT = [0] * maxN

def add(x, y):
	return (x + y) % MOD

def multiply(x, y):
	return x * y % MOD

def power(x, y):
	if y == 0:
		return 1
	elif y % 2:
		return multiply(x, power(x, y - 1))
	else:
		a = power(x, y // 2)
		return multiply(a, a)

def inverse(x):
	return power(x, MOD - 2)

def divide(x, y):
	return multiply(x, inverse(y))

def allFactorials():
	FACT[0] = 1
	for i in range(1, maxN):
		FACT[i] = multiply(i, FACT[i - 1])

def inverseFactorials():
	n = len(INV_FACT)
	INV_FACT[n - 1] = inverse(FACT[n - 1])
	for i in range(n - 2, -1, -1):
		INV_FACT[i] = multiply(INV_FACT[i + 1], i + 1)

def coeffBinom(n, k):
	if n < k:
		return 0
	return multiply(FACT[n], multiply(INV_FACT[k], INV_FACT[n - k]))

def create_graph(n, m, undirected=1, unweighted=1):
	graph = [[] for i in range(n)]
	if unweighted:
		for i in range(m):
			[x, y] = li(lag=-1)
			graph[x].append(y)
			if undirected:
				graph[y].append(x)
	else:
		for i in range(m):
			[x, y, w] = li(lag=-1)
			w += 1
			graph[x].append([y, w])
			if undirected:
				graph[y].append([x, w])
	return graph

def create_tree(n, unweighted=1):
	children = [[] for i in range(n)]
	if unweighted:
		for i in range(n - 1):
			[x, y] = li(lag=-1)
			children[x].append(y)
			children[y].append(x)
	else:
		for i in range(n - 1):
			[x, y, w] = li(lag=-1)
			w += 1
			children[x].append([y, w])
			children[y].append([x, w])
	return children

def dist(tree, n, A, B=-1):
	s = [[A, 0]]
	(massimo, massimo_nodo) = (0, 0)
	distanza = -1
	v = [-1] * n
	while s:
		(el, dis) = s.pop()
		if dis > massimo:
			massimo = dis
			massimo_nodo = el
		if el == B:
			distanza = dis
		for child in tree[el]:
			if v[child] == -1:
				v[child] = 1
				s.append([child, dis + 1])
	return (massimo, massimo_nodo, distanza)

def diameter(tree):
	(_, foglia, _) = dist(tree, n, 0)
	(diam, _, _) = dist(tree, n, foglia)
	return diam

def dfs(graph, n, A):
	v = [-1] * n
	s = [[A, 0]]
	v[A] = 0
	while s:
		(el, dis) = s.pop()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def bfs(graph, n, A):
	v = [-1] * n
	s = deque()
	s.append([A, 0])
	v[A] = 0
	while s:
		(el, dis) = s.popleft()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def parents_children_root_unrooted_tree(tree, n, root=0):
	q = deque()
	visited = [0] * n
	parent = [-1] * n
	children = [[] for i in range(n)]
	q.append(root)
	while q:
		all_done = 1
		visited[q[0]] = 1
		for child in tree[q[0]]:
			if not visited[child]:
				all_done = 0
				q.appendleft(child)
		if all_done:
			for child in tree[q[0]]:
				if parent[child] == -1:
					parent[q[0]] = child
					children[child].append(q[0])
			q.popleft()
	return (parent, children)

def all_longest_path_passing_from_node(parent, children, n):
	q = deque()
	visited = [len(children[i]) for i in range(n)]
	downwards = [[0, 0] for i in range(n)]
	upward = [1] * n
	longest_path = [1] * n
	for i in range(n):
		if not visited[i]:
			q.append(i)
			downwards[i] = [1, 0]
	while q:
		node = q.popleft()
		if parent[node] != -1:
			visited[parent[node]] -= 1
			if not visited[parent[node]]:
				q.append(parent[node])
		else:
			root = node
		for child in children[node]:
			downwards[node] = sorted([downwards[node][0], downwards[node][1], downwards[child][0] + 1], reverse=True)[0:2]
	s = [node]
	while s:
		node = s.pop()
		if parent[node] != -1:
			if downwards[parent[node]][0] == downwards[node][0] + 1:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][1])
			else:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][0])
		longest_path[node] = downwards[node][0] + downwards[node][1] + upward[node] - min([downwards[node][0], downwards[node][1], upward[node]]) - 1
		for child in children[node]:
			s.append(child)
	return longest_path

def c(n):
	co = 0
	while n > 0:
		co += D[n % 10]
		n = n // 10
	return co
D = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
(a, b) = li()
ce = 0
for i in range(a, b + 1):
	ce += c(i)
print(ce)


(start, end) = map(int, input().split())
seven_segment = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
numbers = ' '.join([str(i) for i in range(start, end + 1)])
output = 0
for (i, e) in enumerate(seven_segment):
	i_th_digit = e * numbers.count(str(i))
	output += i_th_digit
print(output)


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)


import io
import sys
import time
start = time.clock()
(a, b) = map(int, input().split())
m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
sm = sum(m)

def segs(i):
	s = 0
	for d in map(int, str(i)):
		s += m[d]
	return s
s = 0
if b < a + 10:
	for i in range(a, b + 1):
		s += segs(i)
else:
	aa = a // 10 * 10 + 10
	bb = b // 10 * 10
	for i in range(a, aa):
		s += segs(i)
	for i in range(aa // 10, bb // 10):
		s += segs(i) * 10
		s += sm
	for i in range(bb, b + 1):
		s += segs(i)
print(s)
dur = time.clock() - start


def main():
	[a, b] = [int(_) for _ in input().split()]
	calc_dict = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	count_digits = []
	count_1_to_1000000 = 28733372
	final_count = 0
	if b - a + 1 < 500000:
		s = str(list(range(a, b + 1)))
		for i in range(10):
			final_count += s.count(str(i)) * calc_dict[i]
	else:
		s = str(list(range(1, a))) + str(list(range(b + 1, 1000001)))
		for i in range(10):
			final_count += s.count(str(i)) * calc_dict[i]
		final_count = count_1_to_1000000 - final_count
	print(final_count)
main()


m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
dp = [-1 for i in range(0, 10 ** 6 + 1)]

def calc(n):
	if n < 10:
		return m[n]
	if dp[n] != -1:
		return dp[n]
	ans = m[n % 10] + calc(n // 10)
	dp[n] = ans
	return ans
(a, b) = map(int, input().split())
ans = sum(map(calc, (i for i in range(a, b + 1))))
print(ans)


from sys import stdin as fin
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)


(a, b) = list(map(int, input().strip().split()))
d = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
s = 0
for i in range(a, b + 1):
	k = str(i)
	for c in k:
		s += d[c]
print(s)


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


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


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


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


(X, Segment) = (list(map(int, input().split())), [6, 2, 5, 5, 4, 5, 6, 3, 7, 6])
Numbers = str(list(range(X[0], X[1] + 1)))
print(sum((Numbers.count(str(i)) * Segment[i] for i in range(10))))


li = tuple([6, 2, 5, 5, 4, 5, 6, 3, 7, 6])

def count(n):
	ret = 0
	while n > 0:
		ret += li[n % 10]
		n //= 10
	return ret
(a, b) = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
	cnt += count(i)
print(cnt)


segments = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
(i, j) = map(int, input().split())
numbers = str(list(range(i, j + 1)))
result = 0
for k in range(len(segments)):
	result += segments[k] * numbers.count(str(k))
print(result)


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

def num(n):
	ans = 0
	while n > 0:
		rem = n % 10
		ans += val[rem]
		n = n // 10
	return ans
(a, b) = map(int, input().split())
s = 0
for i in range(a, b + 1):
	s += num(i)
print(s)


import math

def main_function():
	hash = {}
	hash['1'] = 2
	hash['2'] = 5
	hash['0'] = 6
	hash['3'] = 5
	hash['4'] = 4
	hash['5'] = 5
	hash['6'] = 6
	hash['7'] = 3
	hash['8'] = 7
	hash['9'] = 6
	counter = 0
	(a, b) = [int(i) for i in input().split(' ')]
	for i in range(a, b + 1):
		for j in str(i):
			counter += hash[j]
	print(counter)
main_function()


(a, b) = list(input().split())
t = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
v = 0
for k in range(int(a), int(b) + 1):
	s = str(k)
	for i in s:
		v += t[i]
print(v)


count = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
(a, b) = list(map(int, input().split()))
s = 0
res = ''.join(map(str, range(a, b + 1)))
for i in range(10):
	s += res.count(str(i)) * count[str(i)]
print(s)


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


__author__ = 'artyom'
w = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
ws = w.copy()
for i in range(1, 10):
	ws[i] += ws[i - 1]

def calc(n):
	r = 1000000
	s = 0
	while r > 0:
		if n // r > 0:
			if n // (r * 10) == 0:
				z = n // r
				if z > 1:
					s += (ws[z - 1] - ws[0]) * r
				s += w[z] * (1 + n % r)
			else:
				s += (ws[9] - ws[0]) * r + ws[9] * r * (n // (r * 10) - 1)
				z = n % (r * 10) // r
				if z > 0:
					s += ws[z - 1] * r
				s += w[z] * (1 + n % r)
		r //= 10
	return s

def main():
	(a, b) = read(3)
	return calc(b) - calc(a - 1)

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s)
write(main())


dt = {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())
print(sum((sum((dt[int(ni)] for ni in str(n))) for n in range(a, b + 1))))


def main():
	(a, b) = map(int, input().split())
	nums = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
	sum_ = 0
	for i in range(a, b + 1):
		s = str(i)
		for char in s:
			sum_ += nums[int(char)]
	print(sum_)
main()


d = {'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())
result = 0
for i in range(b - a + 1):
	for ch in f'{a + i}':
		result += d[ch]
print(result)


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

def get_ans(u):
	ans = 0
	while u > 0:
		ans += seg[u % 10]
		u //= 10
	return ans
ans = 0
[a, b] = [int(i) for i in input().split(' ')]
for x in range(a, b + 1):
	ans += get_ans(x)
print(ans)


(a, b) = map(int, input().split())
cnt = [0] * 11
for i in range(a, b + 1):
	while i:
		digit = i % 10
		cnt[digit] += 1
		i = i // 10
ans = 0
ans += cnt[0] * 6
ans += cnt[1] * 2
ans += cnt[2] * 5
ans += cnt[3] * 5
ans += cnt[4] * 4
ans += cnt[5] * 5
ans += cnt[6] * 6
ans += cnt[7] * 3
ans += cnt[8] * 7
ans += cnt[9] * 6
print(ans)


def calc():
	(a, b) = [int(i) for i in input().split()]
	d = {'0': 6, '1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}
	ans = 0
	for i in range(a, b + 1):
		number = str(i)
		for j in number:
			ans += d[j]
	print(ans)
calc()


(a, b) = (int(i) for i in input().split())
s = 0
for i in range(a, b + 1):
	i = str(i)
	for j in i:
		if j == '0' or j == '6' or j == '9':
			s += 6
		elif j == '1':
			s += 2
		elif j == '2' or j == '3' or j == '5':
			s += 5
		elif j == '4':
			s += 4
		elif j == '8':
			s += 7
		elif j == '7':
			s += 3
print(s)


l = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
sum = 0
(a, b) = map(int, input().split())
for i in range(a, b + 1):
	while i > 0:
		c = i % 10
		sum += l[c]
		i //= 10
print(sum)


(n, m) = map(int, input().split())
s = str(list(range(n, m + 1)))
ans = 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')
print(ans)


(a, b) = list(map(int, input().split(' ')))
i = a
segment = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
sum = 0
s = str([i for i in range(a, b + 1)])
for i in range(10):
	sum += s.count(str(i)) * segment[i]
print(sum)


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

def f(n):
	ans = 0
	while n != 0:
		ans += cnt[n % 10]
		n //= 10
	return ans
(a, b) = map(int, input().split())
ans = 0
for i in range(a, b + 1):
	ans += f(i)
print(ans)


import sys
import math
import bisect
import itertools
import random
import re

def query_value(c):
	n = ord(c) - ord('0')
	if n == 0:
		return 6
	if n == 1:
		return 2
	if n == 2:
		return 5
	if n == 3:
		return 5
	if n == 4:
		return 4
	if n == 5:
		return 5
	if n == 6:
		return 6
	if n == 7:
		return 3
	if n == 8:
		return 7
	if n == 9:
		return 6
	return -1

def solve(n):
	ans = 0
	for c in str(n):
		ans += query_value(c)
	return ans

def main():
	(l, r) = map(int, input().split())
	ans = 0
	for i in range(l, r + 1):
		ans += solve(i)
	print(ans)
main()


(a, b) = [int(i) for i in input().split()]
dict1 = {0: 6, 1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
sum1 = 0
for i in range(a, b + 1):
	for j in str(i):
		sum1 = sum1 + dict1[int(j)]
print(sum1)