The restaurant AtCoder serves the following five dishes:
 - ABC Don (rice bowl): takes A minutes to serve.
 - ARC Curry: takes B minutes to serve.
 - AGC Pasta: takes C minutes to serve.
 - APC Ramen: takes D minutes to serve.
 - ATC Hanbagu (hamburger patty): takes E minutes to serve.
Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.
This restaurant has the following rules on orders:
 - An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).
 - Only one dish can be ordered at a time.
 - No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.
E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

-----Constraints-----
 - A, B, C, D and E are integers between 1 and 123 (inclusive).

-----Input-----
Input is given from Standard Input in the following format:
A
B
C
D
E

-----Output-----
Print the earliest possible time for the last dish to be delivered, as an integer.

-----Sample Input-----
29
20
7
35
120

-----Sample Output-----
215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:
 - Order ABC Don at time 0, which will be delivered at time 29.
 - Order ARC Curry at time 30, which will be delivered at time 50.
 - Order AGC Pasta at time 50, which will be delivered at time 57.
 - Order ATC Hanbagu at time 60, which will be delivered at time 180.
 - Order APC Ramen at time 180, which will be delivered at time 215.
There is no way to order the dishes in which the last dish will be delivered earlier than this.

Difficulty: EASY

Solutions:
a_list = [int(input()) for i in range(5)]
sum = 0
for i in a_list:
	sum += (i + 9) // 10 * 10
ans_list = []
for i in a_list:
	b = (i + 9) // 10 * 10 - i
	ans_list.append(sum - b)
print(min(ans_list))


import math
s = 0
m = 10
for i in range(5):
	a = int(input())
	s += math.ceil(a / 10) * 10
	if a % 10 != 0:
		m = min(m, a % 10)
print(s - (10 - m))


import sys
import math
a = [int(input()) for i in range(5)]
ans = 0
min = 11
check = True
for i in range(5):
	if a[i] % 10 < min and a[i] % 10 != 0:
		min = a[i] % 10
		check = False
if check:
	min = 0
b = 100
for j in range(5):
	if a[j] % 10 == min:
		b = j
value = a.pop(b)
for x in a:
	ans += int(math.ceil(x / 10.0)) * 10
ans += value
print(ans)


l = [int(input()) for _ in [0] * 5]
print(sum([(x + 9) // 10 * 10 for x in l]) + min([x % 10 if x % 10 else 10 for x in l]) - 10)


import math
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
a = math.ceil(A * 0.1) * 10
b = math.ceil(B * 0.1) * 10
c = math.ceil(C * 0.1) * 10
d = math.ceil(D * 0.1) * 10
e = math.ceil(E * 0.1) * 10
lst1 = [A, B, C, D, E]
lst2 = [a, b, c, d, e]
last = 0
max_num = -1
for (i, j) in zip(lst1, lst2):
	if j - i > max_num:
		last = i
		max_num = j - i
ans = 0
k = lst1.index(last)
for n in range(5):
	if n == k:
		ans += lst1[n]
	else:
		ans += lst2[n]
print(ans)


ans = 0
mai = 0
for _ in range(5):
	x = int(input())
	ans += (x + 9) // 10 * 10
	if x % 10 != 0:
		mai = max(mai, 10 - x % 10)
print(ans - mai)


p = [int(input()) for i in range(5)]
q = [10 * (0 - -i // 10) for i in p]
res = 10 ** 6
for i in range(5):
	res = min(res, sum(q) - q[i] + p[i])
print(res)


dishes = [int(input()) for i in range(5)]
d = [abs(d % 10 - 10) for d in dishes if d % 10 != 0]
if d:
	d.remove(max(d))
print(sum(dishes) + sum(d))


import math
k = []
sa = []
for i in range(5):
	a = int(input())
	j = math.ceil(a / 10) * 10
	k.append(j)
	m = j - a
	sa.append(m)
print(sum(k) - max(sa))


t = 0
for i in sorted([int(input()) for i in ' ' * 5], key=lambda x: -x % 10 - (x % 10 < 1)):
	t += i + (10 - t % 10) % 10
print(t)


a = [int(input()) for i in range(5)]
b = [9 - (i - 1) % 10 for i in a]
print(sum(a) + sum(b) - max(b))


V = [int(input()) for _ in range(5)]
v_mod = [x % 10 if x % 10 != 0 else 10 for x in V]
min_mod = min(v_mod)
ans = 0
for (i, v) in enumerate(V):
	ans += v + (10 - v_mod[i])
ans -= 10 - min_mod
print(ans)


l = [int(input()) for _ in range(5)]
l.sort(key=lambda x: (10 - x) % 10)
res = l[-1]
for i in range(4):
	res += (l[i] + 9) // 10 * 10
print(res)


ans = 0
b = 10
for _ in range(5):
	a = int(input())
	ans += (a + 9) // 10 * 10
	b = min((a - 1) % 10 + 1, b)
print(ans - 10 + b)


import itertools
dish = [int(input()) for _ in range(5)]
dishp = list(itertools.permutations(dish, 5))
ans = sum(dish) * 10
for dp in dishp:
	temp = 0
	cnt = 0
	dp = list(dp)
	while len(dp) > 0:
		now = dp.pop(0)
		cnt += 1
		if cnt < 5:
			if now % 10 == 0:
				temp += now
			else:
				temp += (now // 10 + 1) * 10
		else:
			temp += now
			ans = min(ans, temp)
print(ans)


import itertools
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
ls = [A, B, C, D, E]
ls2 = []
for i in itertools.permutations(ls, 5):
	ls2.append(list(i))
minimum = 10 ** 5
for i in ls2:
	now = 0
	for j in range(5):
		if j == 0:
			now += i[j]
		elif now % 10 == 0:
			now += i[j]
		else:
			now = 10 * (now // 10 + 1)
			now += i[j]
	if now < minimum:
		minimum = now
print(minimum)


import math
l = [int(input()) for _ in range(5)]
s = [math.ceil(i / 10) * 10 - i for i in l]
print(sum(l) + sum(s) - max(s))


a = [int(input()) for _ in range(5)]
b = [-(-e // 10) * 10 - e for e in a]
print(sum(a) + sum(b) - max(b))


n = [int(input()) for i in range(5)]
m = min(n, key=lambda x: (x + 9) % 10)
n.remove(m)
print(sum([(i + 9) // 10 * 10 for i in n]) + m)


l = [int(input()) for i in range(5)]
L = []
for i in l:
	if i % 10 == 0:
		L.append(0)
	else:
		L.append(10 - i % 10)
print(sum(l) + sum(L) - max(L))


duration = [0] * 5
duration[0] = int(input())
duration[1] = int(input())
duration[2] = int(input())
duration[3] = int(input())
duration[4] = int(input())
digit = list(map(lambda x: x % 10, duration))
if any((x != 0 for x in digit)):
	least = min([x for x in digit if x != 0])
	idx = digit.index(least)
else:
	idx = 0
ans = 0
for i in range(5):
	if i != idx:
		ans += (duration[i] + 9) // 10 * 10
	else:
		ans += duration[i]
print(ans)


l = [int(input()) for _ in range(5)]
a = list(map(lambda x: -(-x // 10) * 10, l))
b = list(map(lambda x: x % 10 if x % 10 else 10, l))
print(sum(a) - (10 - min(b)))


from sys import stdin
import math
A = [int(x) for x in stdin.readlines()]
B = [math.ceil(x / 10) * 10 - x for x in A]
print(sum(A + B) - max(B))


n = []
for _ in range(5):
	n += [int(input())]
n.sort(key=lambda m: (m - 1) % 10)
for i in range(1, 5):
	n[i] = (n[i] // 10 + (n[i] % 10 > 0)) * 10
print(sum(n))


A = [int(input()) for _ in range(5)]
can_saves = [(10 - x) % 10 for x in A]
times = [(x + 9) // 10 * 10 for x in A]
print(sum(times) - max(can_saves))


a = [int(input()) for _ in range(5)]
b = [(i // 10 + 1) * 10 if i % 10 != 0 else i for i in a]
c = [j - i for (i, j) in zip(a, b)]
print(sum(b) - max(c))


from itertools import permutations
import math
INF = float('inf')
menu = 5
times = [int(input()) for i in range(menu)]
orders = list(permutations(times, menu))
minimum = INF
for order in orders:
	total = order[0]
	for i in range(1, menu):
		total += math.ceil(order[i] / 10) * 10
	minimum = min(minimum, total)
print(minimum)


l = [int(input()) for _ in range(5)]
t = max(map(lambda x: (10 - x % 10) % 10, l))
print(sum(map(lambda x: (x + 9) // 10 * 10, l)) - t)


import math
a = []
for i in range(5):
	a.append(int(input()))
sum = 0
r = 10
for i in range(5):
	if a[i] % 10 == 0:
		sum += a[i]
	elif a[i] % 10 != 0:
		r = min(r, a[i] % 10)
		sum += 10 * math.ceil(a[i] / 10)
print(sum - 10 + r)


A = [int(input()) for _ in [0] * 5]
B = [-(-a // 10) * 10 - a for a in A]
print(sum(B) + sum(A) - max(B))


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
MENU = [A, B, C, D, E]
amari = 0
amari_mod = 10
ans = 0
amari_cnt = 0
for menu in MENU:
	if menu % 10 < amari_mod and menu % 10 != 0:
		amari = menu
		amari_mod = menu % 10
for menu in MENU:
	if menu == amari and amari_cnt == 0:
		ans += menu
		amari_cnt += 1
	elif menu % 10 == 0:
		ans += menu
	else:
		menu = menu - menu % 10 + 10
		ans += menu
print(ans)


A = [int(input()) for i in range(5)]
d = 10
ans = 0
for a in A:
	ans += 0 - -a // 10 * 10
	if a % 10:
		d = min(d, a % 10)
print(ans - 10 + d)


def ans123(A: int, B: int, C: int, D: int, E: int):
	serch_list = [A, B, C, D, E]
	number = 0
	minnum = 0
	min = 1
	if A % 10 == 0 and B % 10 == 0 and (C % 10 == 0) and (D % 10 == 0) and (E % 10 == 0):
		return A + B + C + D + E
	else:
		for i in range(5):
			x = serch_list[i]
			if x % 10 != 0 and -(-x // 10) * 10 - x >= min:
				min = -(-x // 10) * 10 - x
				number = i
				minnum = x
		del serch_list[number]
	return -(-serch_list[0] // 10) * 10 + -(-serch_list[1] // 10) * 10 + -(-serch_list[2] // 10) * 10 + -(-serch_list[3] // 10) * 10 + minnum
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
print(ans123(A, B, C, D, E))


menu = []
menu2 = []
total = False
c = 0
total2 = 0
for i in range(5):
	a = int(input())
	menu.append(a)
	menu2.append(a % 10)
	if a % 10 == 0:
		total2 += 1
if total2 == 5:
	print(sum(menu))
else:
	for i in range(1, 10):
		for k in range(5):
			if menu2[k] == i:
				total = True
				c = k
				break
		if total == True:
			break
	print(sum(menu) + 10 * (4 - total2) - sum(menu2) + menu2[c])


n = 5
r = 0
rem = 10
import math
for _ in range(n):
	a = int(input())
	if a % 10 != 0:
		rem = min(rem, a % 10)
	r += math.ceil(a / 10)
print(int(r * 10) - 10 + rem)


a = [int(input()) for _ in range(5)]
(z, ans) = (123, 0)
for i in a:
	if i % 10 != 0:
		z = min(z, i % 10)
	ans += 10 * ((i + 10 - 1) // 10)
print(ans + z - 10 if z != 123 or z == 0 else ans)


t = [int(input()) for i in range(5)]
a = min(map(lambda x: (x - 1) % 10 + 1, t))
b = sum(map(lambda x: -(-x // 10) * 10, t))
print(a + b - 10)


A = [int(input()) for a in range(5)]
A.sort(key=lambda x: 10 - (x - 1) % 10)
ans = 0
for i in range(4):
	if A[i] % 10 != 0:
		A[i] = A[i] // 10 * 10 + 10
print(sum(A))


import itertools
arr = []
mins = []
for _ in range(5):
	arr.append(int(input()))
for comb in list(itertools.permutations(arr)):
	ans = 0
	for (i, ele) in enumerate(comb):
		ans += ele
		if not i == len(comb) - 1:
			diff = 10 - ans % 10
			if diff == 10:
				diff = 0
			ans += diff
	mins.append(ans)
print(min(mins))


A = [int(input()) for x in range(5)]
B = [(10 - s % 10) % 10 for s in A]
print(sum(A) + sum(B) - max(B))


details = []
for i in range(5):
	details.append(int(input()))
new_list = []
for i in range(10):
	current = 10 - i
	for numbers in details:
		if (numbers - current) % 10 == 0:
			new_list.append(numbers)
counter = 0
for numbers in new_list[:len(new_list) - 1]:
	current = numbers
	while current % 10 != 0:
		current += 1
	counter += current
print(counter + new_list[-1])


dish = [int(input()) for i in range(5)]
dish_s = [(dish[i] + 9) // 10 for i in range(5)]
dish_d = [dish[i] % 10 for i in range(5)]
sum = 0
for i in range(5):
	sum += dish_s[i]
m = 0
for i in range(5):
	if dish_s[i] * 10 - dish[i] > m:
		m = dish_s[i] * 10 - dish[i]
print(sum * 10 - m)


a = [int(input()) for i in range(5)]
mi = min(map(lambda x: (x - 1) % 10, a)) + 1
print(sum(map(lambda x: (x + 9) // 10 * 10, a)) - (10 - mi))


a = [int(input()) for _ in range(5)]
b = [(10 - i % 10) % 10 for i in a]
c = max(b)
print(sum([(j + 9) // 10 * 10 for j in a]) - c)


a = [int(input()) for _ in range(5)]
b = 10 - min([a[i] % 10 for i in range(5) if 0 < a[i] % 10] or [10])
print(sum([-(-a[i] // 10) for i in range(5)]) * 10 - b)


cuisine = [int(input()) for _ in ' ' * 5]
time = [(a + 9) // 10 * 10 - a for a in cuisine]
print(sum(time) + sum(cuisine) - max(time))


A = [int(input()) for i in range(5)]
cnt = 0
res = 0
for i in A:
	cnt += (i + 9) // 10
	res = max(res, (10 - i % 10) % 10)
print(cnt * 10 - res)


X = [int(input()) for _ in range(5)]
S = [round(x + 4.9, -1) for x in X]
d = [round(x + 4.9, -1) - x for x in X]
print(int(sum(S) - max(d)))


l = [int(input()) for _ in [0] * 5]
n = [10 - x % 10 if x % 10 else 0 for x in l]
m = min([x % 10 if x % 10 else 10 for x in l])
print(sum(l + n) + (m - 10 if m else 0))


a = [int(input()) for _ in range(5)]
t = []
for i in range(5):
	c = (10 - a[i]) % 10
	t.append(c)
print(sum(a) + sum(t) - max(t))


l = [int(input()) for _ in range(5)]
r = sorted([10 - (10 - i) % 10 for i in l])
u = [-(-i // 10) * 10 for i in l]
print(sum(u) - (10 - r[0]))


import math
m = [int(input()) for _ in range(5)]
ans = 0
b = 0
for i in m:
	ans += math.ceil(i / 10) * 10
	if i % 10 != 0:
		b = max(b, 10 - i % 10)
print(ans - b)


A = sorted([int(input()) for _ in range(5)])
B = [(i + 9) // 10 * 10 for i in A]
C = []
for i in range(5):
	C.append(int(B[i]) - int(A[i]))
print(sum(B) - max(C))


A = [int(input()) for i in range(5)]
ma = max([0 if a % 10 == 0 else 10 - a % 10 for a in A])
A = [a if a % 10 == 0 else a + 10 - a % 10 for a in A]
print(sum(A) - ma)


import math as mt
a = [int(input()) for i in range(5)]
for i in range(5):
	if a[i] % 10 != 0 and a[i] % 10 < a[0] % 10:
		(a[0], a[i]) = (a[i], a[0])
t = [mt.ceil(a[i] / 10) * 10 for i in range(1, 5)]
print(a[0] + sum(t))


a = list((int(input()) for _ in range(5)))
b = list(map(lambda x: (10 - x % 10) % 10, a))
ans = sum(a) + sum(b) - max(b)
print(ans)


M = 0
ans = 0
for i in range(5):
	a = int(input())
	b = (a + 9) // 10 * 10
	M = max(M, b - a)
	ans += b
print(ans - M)


ans = 0
hiku = 0
for i in range(5):
	x = int(input())
	if x % 10 != 0:
		hiku = max(hiku, 10 - x % 10)
	ans += (x + 9) // 10 * 10
print(ans - hiku)


import math
L = [int(input()) for _ in range(5)]
L.sort(key=lambda x: (x - 1) % 10)
print(L[0] + sum(map(lambda x: math.ceil(x / 10) * 10, L[1:])))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a, b, c, d, e]
f.sort()
x = 0
for i in range(5):
	if f[i] % 10 == 0:
		x = x + f[i]
	if f[i] % 10 != 0:
		x = x + f[i] // 10 * 10 + 10
g = a - a // 10 * 10
h = b - b // 10 * 10
i = c - c // 10 * 10
j = d - d // 10 * 10
k = e - e // 10 * 10
l = [g, h, i, j, k]
l.sort()
y = 0
z = 0
for i in range(5):
	if l[i] != 0:
		y = y + 1
		z = i
		break
if y == 0:
	print(x)
else:
	print(x - (10 - l[z]))


T = [int(input()) for i in range(5)]
t = 0
R = []
for i in range(5):
	t += -(-T[i] // 10) * 10
	R += [-(-T[i] // 10) * 10 - T[i]]
print(t - max(R))


from itertools import permutations
ls = [int(input()) for _ in range(5)]
ans = 1000000
for p in permutations(ls):
	t = 0
	for x in p[:-1]:
		t += x
		if t % 10 != 0:
			t += 10 - t % 10
	t += p[-1]
	ans = min(ans, t)
print(ans)


l = [int(input()) for _ in range(5)]
from operator import itemgetter
for i in range(5):
	l[i] += 9
	l[i] = str(l[i])
l.sort(key=itemgetter(-1), reverse=True)
for i in range(5):
	l[i] = int(l[i])
	l[i] -= 9
ans = 0
for i in range(5):
	if l[i] % 10 == 0:
		ans += l[i]
	elif i == 4:
		ans += l[i]
	else:
		ans += l[i] + 10 - l[i] % 10
print(ans)


M = [int(input()) for i in range(5)]
a = [((i - 1) // 10 + 1) * 10 for i in M]
b = [(i - 1) % 10 for i in M]
ans = sum(a) + min(b) - 9
print(ans)


x = []
x = [int(input()) for _ in range(5)]
print(sum(map(lambda i: -(-i // 10 * 10) - i, x)) + sum(x) - max(map(lambda i: -(-i // 10 * 10) - i, x)))


a = [int(input()) for _ in range(5)]
b = [(i - 1) % 10 + 1 for i in a]
count = sum(((i // 10 + (1 if i % 10 != 0 else 0)) * 10 for i in a))
print(count - (10 - min(b)))


X = sorted([int(input()) for _ in range(5)], key=lambda x: x % 10 if x % 10 == 0 else 10 - x % 10)
ans = sum([(x + 9) // 10 * 10 for x in X[:-1]])
print(ans + X[-1])


times = [int(input()) for _ in range(5)]
delays = [(10 - t) % 10 for t in times]
max_delay = max(delays)
print(sum(times) + sum(delays) - max_delay)


(e, *a) = sorted(eval('int(input()),' * 5), key=lambda x: (x % 10 - 1) % 10)
print(e - sum((-i // 10 * 10 for i in a)))


A = [int(input()) for _ in range(5)]
a = 0
s = 0
for l in A:
	b = -(-l // 10) * 10
	s += b
	c = b - l
	if a < c:
		a = c
print(s - a)


A = 0
B = []
B.append(0)
for i in range(5):
	I = int(input())
	A += I
	T = I % 10
	if T != 0:
		B.append(10 - T)
print(A + sum(B) - max(B))


d = list(map(int, open(0)))
d.sort(key=lambda x: (x - 1) % 10, reverse=True)
print(sum(((x + 9) // 10 * 10 for x in d[:-1])) + d[-1])


from math import ceil
time = [int(input()) for i in range(5)]
mod = [i % 10 for i in time]
a = 124
res = 0
for i in range(len(mod)):
	if mod[i] != 0:
		a = min(a, mod[i])
if a == 124:
	a = 0
for i in range(5):
	if i == mod.index(a):
		res += time[i]
	else:
		res += ceil(time[i] / 10) * 10
print(res)


(*t,) = map(int, open(0).read().split())
print(sum((-(-i // 10) * 10 for i in t)) + min((-(-i % 10) for i in t)))


N = 5
A = [int(input()) for _ in range(N)]
if A[0] % 10 == 0 and A[1] % 10 == 0 and (A[2] % 10 == 0) and (A[3] % 10 == 0) and (A[4] % 10 == 0):
	ans = sum(A)
else:
	ans = 0
	B = []
	for i in range(N):
		if A[i] % 10 == 0:
			ans += A[i]
		else:
			B.append(A[i])
	C = [k % 10 for k in B]
	m = C.index(min(C))
	for i in range(len(B)):
		if i == m:
			ans += B[i]
		else:
			ans += (B[i] // 10 + 1) * 10
print(ans)


a = []
ans = 0
for i in range(5):
	s = int(input())
	ans += (s + 9) // 10 * 10
	a.append((s + 9) % 10)
a.sort()
ans -= 9 - a[0]
print(ans)


A = []
for i in range(5):
	A.append(int(input()))
import itertools
per = list(itertools.permutations(range(5)))
ans = []
check = 0
for k in per:
	time = 0
	for i in range(5):
		s = k[i]
		time += A[s]
		temp = time // 10
		if time % 10 != 0 and i != 4:
			time = (temp + 1) * 10
	ans.append(time)
print(min(ans))


a = [int(input()) for _ in range(5)]
t = 0
m = 10
for x in a:
	t += (x + 9) // 10 * 10
	m = min((x - 1) % 10 + 1, m)
print(t - 10 + m)


ls = []
for i in range(5):
	ls.append(int(input()))
rm = 10
time = 0
for i in ls:
	if i % 10 == 0:
		time += i
	else:
		time += (i // 10 + 1) * 10
		rm = min(rm, i % 10)
time += rm - 10
print(time)


A = list((int(input()) for i in range(5)))
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [b - a for (a, b) in zip(A, B)]
print(sum(B) - max(diff))


l = [int(input()) for _ in range(5)]
m = [(x + 9) // 10 * 10 for x in l]
d = [x - y for (x, y) in zip(m, l)]
print(sum(m) - max(d))


l = [int(input()) for _ in range(5)]
m = 9 - min([(i - 1) % 10 for i in l])
print(sum([((i - 1) // 10 + 1) * 10 for i in l]) - m)


x = [int(input()) for i in range(5)]
y = 0
for i in range(5):
	y += x[i] + -x[i] % 10
z = max((-x[i] % 10 for i in range(5)))
print(y - z)


n = list(map(int, open(0).read().split()))
n.sort(key=lambda x: -((x - 1) % 10))
print(sum([((x - 1) // 10 + 1) * 10 for x in n[:-1]] + [n[-1]]))


meal = list((int(input()) for _ in range(5)))
meal_t = [(10 - tmp % 10) % 10 for tmp in meal]
print(sum(meal) + sum(meal_t) - max(meal_t))


li = [int(input()) for i in range(5)]
lic = [(10 - it % 10) % 10 for it in li]
print(sum(li) + sum(lic) - max(lic))


T = [int(input()) for _ in range(5)]
L = [-i % 10 for i in T]
print(sum(T) + sum(L) - max(L))


L1 = [int(input()) for _ in range(5)]
L2 = [0] * 5
for i in range(5):
	L2[i] = (10 - L1[i]) % 10
L2.sort()
print(sum(L1) + sum(L2) - max(L2))


data = [int(input()) for i in range(5)]
if all((i % 10 == 0 for i in data)):
	print(sum(data))
else:
	a = 10
	for i in range(len(data)):
		if data[i] % 10 != 0:
			if a > data[i] % 10:
				a = data[i] % 10
				b = i
	ans = 0
	for i in range(len(data)):
		if i != b:
			if data[i] % 10 != 0:
				ans += (data[i] // 10 + 1) * 10
			else:
				ans += data[i]
		else:
			ans += data[i]
	print(ans)


N = [int(input()) for _ in range(5)]
n = [10 - x % 10 if x % 10 != 0 else 0 for x in N]
ans = sum(N) + sum(n) - max(n)
print(ans)


import math
m1 = [int(input()) for _ in range(5)]
m2 = [math.ceil(x / 10) * 10 for x in m1]
slack = max([x - y for (x, y) in zip(m2, m1)])
print(sum(m2) - slack)


import math
a = [int(input()) for i in range(5)]
sub = 0
cnt = 0
for i in a:
	if i % 10 != 0 and sub < 10 - i % 10:
		sub = 10 - i % 10
	cnt += math.ceil(i / 10) * 10
print(cnt - sub)


l = [int(input()) for i in range(5)]
lm = l
lm = [(i + 9) // 10 * 10 for i in l]
lr = [10 - i % 10 if i % 10 != 0 else 0 for i in l]
print(sum(lm) - max(lr))


A = [int(input()) for i in range(5)]
B = [(10 - a % 10) % 10 for a in A]
print(sum(A) + sum(B) - max(B))


Dish = [int(input()) for _ in range(5)]
Mod = [(D - 1) % 10 + 1 for D in Dish]
print(sum([-(-D // 10) * 10 for D in Dish]) - (10 - min(Mod)))


list_x = []
for i in range(5):
	list_x.append(int(input()))
max_dif = 0
max_dif_index = 0
for i in range(5):
	if 10 - list_x[i] % 10 > max_dif and list_x[i] % 10 != 0:
		max_dif = 10 - list_x[i] % 10
		max_dif_index = i
ans = list_x.pop(max_dif_index)
tmp = 0
for i in range(4):
	tmp += list_x.pop()
	while tmp % 10 != 0:
		tmp += 1
ans += tmp
print(ans)


L = []
M = [0]
for i in range(5):
	A = int(input())
	L.append(A)
	if A % 10 != 0:
		M.append(10 - A % 10)
print(sum(L + M) - max(M))


l = [int(input()) for _ in range(5)]
m = 0
s = 0
for x in l:
	t = -(-x // 10) * 10
	m = max(m, t - x)
	s += t
print(s - m)


a = []
for _ in range(5):
	a.append(int(input()))
b = [i % 10 if i % 10 == 0 else 10 - i % 10 for i in a]
print(sum(a) + sum(b) - max(b))


a = 0
c = 9
for i in range(5):
	b = int(input())
	a += ((b - 1) // 10 + 1) * 10
	c = min((b - 1) % 10, c)
print(a - 9 + c)


minutes = [int(input()) for i in range(5)]
if max((m % 10 for m in minutes)) != 0:
	ones_place_min = min((m % 10 for m in minutes if m % 10 != 0))
	for m in minutes:
		if m % 10 == ones_place_min:
			ones_place_min = m
			break
	minutes.remove(ones_place_min)
	minutes = [m if m % 10 == 0 else (m + 9) // 10 * 10 for m in minutes]
	minutes.append(ones_place_min)
print(sum(minutes))


dish = [0] * 5
t = [0] * 5
for i in range(5):
	dish[i] = int(input())
	t[i] = (10 - dish[i] % 10) % 10
m_t = max(t)
print(sum(dish) + sum(t) - m_t)


f = [int(input()) for i in range(5)]
f.sort(key=lambda x: (x - 1) % 10)
t = f[0]
for v in f[1:]:
	t += (v + 9) // 10 * 10
print(t)


a = [int(input()) for i in range(5)]
b = [i - i % 10 + 10 if i % 10 != 0 else i for i in a]
diff = [y - x for (x, y) in zip(a, b)]
print(sum(b) - max(diff))


dish = [int(input()) for i in range(5)]
reeltime = sorted([10 - x % 10 if x % 10 != 0 else x % 10 for x in dish])
print(sum(dish) + sum(reeltime[:-1]))


import math
import numpy as np
time_list = []
for i in range(5):
	time_list.append(int(input()))
r_list = []
for i in time_list:
	r_list.append((i - 1) % 10)
x = np.argmin(r_list)
for i in range(5):
	if i != x:
		time_list[i] = int(math.ceil(time_list[i] * 0.1) * 10)
print(sum(time_list))


A = [int(input()) for i in range(5)]
num = 10
ans = 0
for i in range(5):
	num = min((A[i] - 1) % 10, num)
	ans += -(-A[i] // 10 * 10)
print(ans + num - 9)


from itertools import permutations
import math
T = [int(input()) for i in range(5)]
res = float('INF')
for order in permutations(T):
	total = order[0]
	for i in range(1, 5):
		total += math.ceil(order[i] / 10) * 10
	res = min(res, total)
print(res)


foods = [int(input()) for _ in range(5)]
order_times = [food - food % 10 + 10 if food % 10 != 0 else food for food in foods]
diff = [order_time - food for (order_time, food) in zip(order_times, foods)]
print(sum(order_times) - max(diff))


N = [int(input()) for _ in range(5)]
chk = [(10 - N[i] % 10) % 10 for i in range(5)]
print(sum(N) + sum(chk) - max(chk))


A = [int(input()) for _ in range(5)]
cook = []
for i in range(5):
	a = (10 - A[i]) % 10
	cook.append(a)
print(sum(A) + sum(cook) - max(cook))


menu = []
jissai_menu = []
for i in range(5):
	menu.append(int(input()))
	if menu[i] % 10 == 0:
		jissai_menu.append(menu[i])
	else:
		jissai_menu.append(menu[i] - menu[i] % 10 + 10)
ans = float('inf')
for i in range(5):
	tmp = 0
	for j in range(5):
		if j == i:
			continue
		tmp += jissai_menu[j]
	ans = min(ans, tmp + menu[i])
print(ans)


from itertools import permutations
import math
menu = 5
times = [int(input()) for i in range(menu)]
orders = list(permutations(times))
minimum = sum((math.ceil(time / 10) * 10 for time in times))
for order in orders:
	total = order[0]
	for i in range(1, menu):
		total += math.ceil(order[i] / 10) * 10
	minimum = min(minimum, total)
print(minimum)


time = list((int(input()) for i in range(5)))

def f(x):
	return (10 - x % 10) % 10
b = list(map(f, time))
ans = sum(time) + sum(b) - max(b)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a % 10 == 0:
	aa = 99
	aaa = a
else:
	aa = a % 10
	aaa = (a // 10 + 1) * 10
if b % 10 == 0:
	bb = 99
	bbb = b
else:
	bb = b % 10
	bbb = (b // 10 + 1) * 10
if c % 10 == 0:
	cc = 99
	ccc = c
else:
	cc = c % 10
	ccc = (c // 10 + 1) * 10
if d % 10 == 0:
	dd = 99
	ddd = d
else:
	dd = d % 10
	ddd = (d // 10 + 1) * 10
if e % 10 == 0:
	ee = 99
	eee = e
else:
	ee = e % 10
	eee = (e // 10 + 1) * 10
if min(aa, bb, cc, dd, ee) == 99:
	print(a + b + c + d + e)
	return
print(aaa + bbb + ccc + ddd + eee - (10 - min(aa, bb, cc, dd, ee)))


import math
xs = [int(input()) for _ in range(5)]
print(sum(xs) + sum(sorted([math.ceil(x * 0.1) * 10 - x for x in xs])[:4]))


l = [int(input()) for i in range(5)]
L = [(l[i] - 1) // 10 + 1 for i in range(5)]
l_1 = [(l[i] - 1) % 10 + 1 for i in range(5)]
print(10 * sum(L) + min(l_1) - 10)


a = [int(input()) for _ in range(5)]
a.sort(key=lambda x: (x - 1) % 10)
print(a[0] + sum((i if i % 10 == 0 else (i // 10 + 1) * 10 for i in a[1:])))


cooktime = []
min_index = 100
min = 123
for i in range(5):
	cooktime.append(int(input('')))
	if cooktime[i] % 10 != 0 and min > cooktime[i] % 10:
		min_index = i
		min = cooktime[i] % 10
sum = 0
for i in range(5):
	sum += cooktime[i]
	if i != min_index and cooktime[i] % 10 != 0:
		sum += 10 - cooktime[i] % 10
print(str(sum))


info = [int(input()) for _ in range(5)]
degit_1 = [(10 - e % 10) % 10 for e in info]
ans = sum(info) + sum(degit_1) - max(degit_1)
print(ans)


l = [int(input()) for _ in range(5)]
l.sort(key=lambda x: (x - 1) % 10)
print(l[0] + sum((t if t % 10 == 0 else t - t % 10 + 10 for t in l[1:])))


lis = [int(input()) for _ in range(5)]
times = [(l + 9) // 10 * 10 for l in lis]
loss = [(10 - l % 10) % 10 for l in lis]
print(sum(times) - max(loss))


abc = [int(input()) + 9 for x in range(5)]
print(sum([x // 10 for x in abc]) * 10 + min([x % 10 for x in abc]) - 9)


l = []
ans = 0
for i in range(5):
	x = int(input())
	ans += x
	if x % 10 == 0:
		l.append(0)
	else:
		l.append(10 - x % 10)
l.sort()
ans += sum(l[:4])
print(ans)


l = list(map(int, open(0).read().split()))
print(sum([(x + 9) // 10 for x in l]) * 10 - 9 + min([(x - 1) % 10 for x in l]))


A = [int(input()) for _ in range(5)]
B = [((i - 1) // 10 + 1) * 10 for i in A]
c = min([A[i] - B[i] for i in range(5)])
print(sum(B) + c)


list1 = [int(input()) for i in range(5)]
d = 0
t = 0
for n in list1:
	m = ((n - 1) // 10 + 1) * 10
	t = t + m
	if m - n > d:
		d = m - n
	else:
		d = d
print(t - d)


t = [int(input()) for _ in range(5)]
v = [10 * (i // 10) if i % 10 == 0 else 10 * (i // 10 + 1) for i in t]
w = max((x - y for (x, y) in zip(v, t)))
print(sum(v) - w)


a = [int(input()) for i in range(5)]
(minn, summ) = (10, 0)
for i in a:
	minn = min(minn, (i - 1) % 10)
	summ += (i + 9) // 10
print(summ * 10 + minn - 9)


a = []
for i in range(5):
	a.append(int(input()))
b = list(map(lambda x: 10 - x % 10 if x % 10 != 0 else 0, a))
b = sorted(b)
print(sum(a) + sum(b[:-1]))


A = []
B = []
for i in range(5):
	A.append(int(input()))
	B.append((10 - A[-1] % 10) % 10)
B.sort()
print(sum(A) + sum(B[:-1]))


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
l = []
if A % 10 > 0:
	l.append(A % 10)
if B % 10 > 0:
	l.append(B % 10)
if C % 10 > 0:
	l.append(C % 10)
if D % 10 > 0:
	l.append(D % 10)
if E % 10 > 0:
	l.append(E % 10)
ans = len(l) * 10 + A + B + C + D + E - sum(l)
if len(l) > 0:
	ans += min(l) - 10
print(ans)


a = [int(input()) for _ in range(5)]
res = 10
for i in a:
	if i % 10:
		res = min(res, i % 10)
ans = 0
for i in a:
	ans += -(-i // 10) * 10
print(ans + res - 10)


ar = []
for i in range(5):
	ar.append(int(input()))
arr = [10 - i % 10 for i in ar]
for i in range(5):
	if arr[i] == 10:
		arr[i] = 0
last = arr.index(max(arr))
time = 0
for (i, x) in enumerate(ar):
	if i != last:
		time += x + arr[i]
time += ar[last]
print(time)


a = [int(input()) for _ in range(5)]
loss = [(10 - i % 10) % 10 for i in a]
print(sum(a + loss) - max(loss))


(a, *t) = map(int, open(0))
c = 0
for t in t:
	b = a + t
	a = a * (0 < a % 10 < t % 10 or t % 10 < 1) or t
	b -= a
	c += b + (10 - b % 10) * (b % 10 > 0)
print(c + a)


ABCDE = list(map(int, [input() for i in range(5)]))
waiting = [(10 - a) % 10 for a in ABCDE]
waiting.sort()
waiting.pop()
print(sum(waiting) + sum(ABCDE))


a = [int(input()) for _ in range(5)]
aa = [-(-x // 10 * 10) for x in a]
b = [x - y for (x, y) in zip(aa, a)]
ans = sum(aa) - max(b)
print(ans)


x = list(map(int, (input() for i in range(5))))
y = sorted(x, key=lambda x: (x + 9) // 10 * 10 - x)
s = 0
for z in y[:-1]:
	s += (10 + z - 1) // 10 * 10
print(s + y[-1])


D = [int(input()) for _ in range(5)]
d = [(10 - i % 10) % 10 for i in D]
s = 0
for i in range(5):
	s += D[i] + d[i]
print(s - max(d))


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a, b, c, d, e]
data = [0] * 5
for i in range(5):
	if f[i] % 10 == 0:
		continue
	else:
		data[i] = 10 - f[i] % 10
print(a + data[0] + b + data[1] + c + data[2] + d + data[3] + e + data[4] - max(data))


a = [int(input()) for _ in range(5)]
x = [10 * (0 - -i // 10) for i in a]
print(sum(x) - max((x[i] - a[i] for i in range(5))))


x = [int(input()) for i in range(5)]
(n, a) = (10, 0)
for i in x:
	if i % 10:
		(n, a) = (min(i % 10, n), a + i - i % 10 + 10)
	else:
		a += i
print(a + n - 10)


l = [int(input()) for i in range(5)]
diff = 0
num = 0
for i in l:
	if i % 10 == 0:
		num += i
	else:
		a = round(i + 5, -1)
		num += a
		diff = max(diff, a - i)
print(num - diff)


(a, b) = (5, 10)
for i in range(5):
	i = int(input())
	a += (i - 1) // 10
	if 0 < i % 10 < b:
		b = i % 10
print(a * 10 - (10 - b))


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
l = [A, B, C, D, E]
tot = 0
for i in l:
	tot += -(-i // 10) * 10
a = max(map(lambda x: -(-x // 10) * 10 - x, l))
print(tot - a)


A = [int(input()) for _ in range(5)]
ceiled = [(x + 9) // 10 * 10 for x in A]
can_save = [y - x for (x, y) in zip(A, ceiled)]
ans = sum(ceiled) - max(can_save)
print(ans)


l = [int(input()) for i in range(5)]
mod = 10
l_div = [(10 - x % 10) % mod for x in l]
sub = max(l_div)
ans = sum(l) + sum(l_div) - sub
print(ans)


A = int(input())
ans = 0
for i in range(4):
	B = int(input())
	if A % 10 > B % 10 > 0:
		(A, B) = (B, A)
	ans += -(-B // 10) * 10
print(A + ans)


dishes = [int(input()) for _ in range(5)]
diffs = [-(-dish // 10) * 10 - dish for dish in dishes]
print(sum(dishes) + sum(diffs) - max(diffs))


a = eval('int(input())-1,' * 5)
print(min((i % 10 for i in a)) + sum(((i // 10 + 1) * 10 for i in a)) - 9)


L = list((int(input()) for _ in range(5)))
ans = 0
for l in L:
	if l % 10 != 0:
		ans += l - l % 10 + 10
	else:
		ans += l
m = 0
for l in L:
	cnt = 0
	if l % 10 == 0:
		cnt += 1
	elif m < 10 - l % 10:
		m = 10 - l % 10
if cnt == 5:
	m = 0
print(ans - m)


import sys
input = sys.stdin.readline
import numpy as np

def main():
	menu = []
	np_menu = []
	[menu.append(int(input())) for _ in range(5)]
	np_menu = np.array(menu)
	s_menu = sorted(np_menu, key=lambda x: x % 10)
	time_counter = 0
	last_add = 0
	for time in s_menu:
		if time % 10 == 0:
			time_counter += time
		elif last_add == 0:
			last_add += time
		else:
			tmp = 10 - time % 10
			time_counter += time + tmp
	time_counter += last_add
	print(time_counter)

def __starting_point():
	main()
__starting_point()


t = 0
for i in sorted(map(int, list(open(0))), key=lambda x: -x % 10 - (x % 10 < 1)):
	t += i + (10 - t) % 10
print(t)


(*H,) = map(int, open(0))
print(sum((10 * (0 - -i // 10) for i in H)) - 9 + min(((j - 1) % 10 for j in H)))


A = [int(input()) for _ in range(5)]
print(sum((((x - 1) // 10 + 1) * 10 for x in A)) - max(((10 - x % 10) % 10 for x in A)))


abcde = [int(input()) for i in range(5)]
ans = 0
m = 10
for i in abcde:
	ans += (i + 9) // 10 * 10
	m = min(m, (i - 1) % 10 + 1)
print(ans - 10 + m)


A = [-int(input()) for _ in range(5)]
m = max(A, key=lambda x: x % 10)
print(-(m - m // 10 * 10 + sum([a // 10 * 10 for a in A])))


(*a,) = map(int, open(0))
b = [(i + 9) // 10 * 10 for i in a]
s = sum(b)
print(min((s - b[i] + a[i] for i in range(5))))


A = [int(input()) for _ in range(5)]
y = min([10] + [x % 10 for x in A if x % 10])
print(sum([10 * (x // 10 + bool(x % 10)) for x in A]) - 10 + y)


k = 0
m = 0
for i in range(5):
	a = int(input())
	k += a + (10 - a % 10) % 10
	m = max(m, (10 - a % 10) % 10)
print(k - m)


import sys
from itertools import permutations

def answer(a: int, b: int, c: int, d: int, e: int) -> int:
	dishes = [a, b, c, d, e]
	ans = sys.maxsize
	for p in permutations(list(range(5))):
		result = 0
		for i in range(5):
			dish = dishes[p[i]]
			if i < 4:
				mod = dish % 10
				if mod != 0:
					result += 10 - mod
			result += dish
		ans = min(ans, result)
	return ans

def main():
	(a, b, c, d, e) = (int(input()) for _ in range(5))
	print(answer(a, b, c, d, e))

def __starting_point():
	main()
__starting_point()


time = [[0] * 2 for i in range(5)]
for i in range(5):
	time[i][0] = int(input())
	if time[i][0] % 10 != 0:
		time[i][1] = 10 * (time[i][0] // 10 + 1) - time[i][0]
time.sort(key=lambda x: x[1])
ans = 0
for i in range(4):
	ans += time[i][0] + time[i][1]
print(ans + time[4][0])


ds = [int(input()) for _ in range(5)]

def f(x):
	return (x + 9) // 10 * 10

def g(x):
	return 10 - x % 10 if x % 10 else 0
print(sum(map(f, ds)) - max(map(g, ds)))


Time = [int(input()) for X in range(0, 5)]
Loss = [(10 - X % 10) % 10 for X in Time]
print(sum(Time) + sum(sorted(Loss)[:4]))


L = []
R = []
for _ in range(5):
	x = int(input())
	L.append(x)
	R.append(-x % 10)
print(sum(L) + sum(R) - max(R))


res = 0
frac = 10
for i in range(5):
	a = int(input())
	if a % 10 != 0:
		frac = min(frac, a % 10)
	res += -(-a // 10) * 10
print(res + frac - 10)


import math
a = [int(input()) for i in range(5)]
w = [(10 - i % 10) % 10 for i in a]
print(sum(a) + sum(w) - max(w))


a = [int(input()) for i in range(5)]
b = list(map(lambda x: (x + 9) // 10 * 10, a))
print(min([sum(b) - b[i] + a[i] for i in range(5)]))


dish = [int(input()) for i in range(5)]
print(sum([(dish[i] - 1) // 10 + 1 for i in range(5)]) * 10 - 9 + min([(dish[i] - 1) % 10 for i in range(5)]))


m = [int(input()) for _ in range(5)]
print(sum([(1 + t // 10) * 10 if t % 10 > 0 else t for t in m]) - max([(1 + t // 10) * 10 - t if t % 10 > 0 else 0 for t in m]))


l = []
for i in range(5):
	l.append(int(input()))
amari = []
for i in range(5):
	if 10 - l[i] % 10 == 10:
		amari.append(0)
	else:
		amari.append(10 - l[i] % 10)
jikan = []
for i in range(5):
	if amari[i] == 10:
		jikan.append(l[i])
	else:
		jikan.append(l[i] + amari[i])
print(sum(jikan) - max(amari))


ans = 10 ** 20
a = [int(input()) for _ in range(5)]
b = [10 * (0 - -i // 10) for i in a]
for i in range(5):
	ans = min(ans, sum(b) - b[i] + a[i])
print(ans)


(e, *a) = sorted(eval('int(input()),' * 5), key=lambda x: (x % 10 - 1) % 10)
t = 0
for i in a:
	t += -(-i // 10) * 10
print(t + e)


x = [int(input()) for _ in range(5)]
x = sorted(x, key=lambda x: (x - 1) % 10 + 1)
print(x[0] + sum([(xi + 9) // 10 * 10 for xi in x[1:]]))


time = 0
l = []
for i in range(5):
	x = int(input())
	time += x
	l += [(130 - x) % 10]
print(time + sum(l) - max(l))


a = [int(input()) for i in range(5)]
n = 0
ans = 0
for x in a:
	if x % 10 != 0:
		t = 10 - x % 10
	else:
		t = 0
	n = max(n, t)
	ans += x + t
print(ans - n)


a = sorted([int(input()) for i in range(5)], key=lambda x: (x - 1) % 10)
for i in range(1, 5):
	a[i] = int((a[i] + 9) / 10) * 10
print(sum(a))


ans = 0
t = []
tmp = 10
for i in range(5):
	t.append(int(input()))
	if t[i] % 10 != 0 and t[i] % 10 < tmp:
		tmp = t[i] % 10
flg = 0
for i in range(5):
	if (t[i] % 10 != tmp or flg == 1) and t[i] % 10 == 0:
		ans += t[i]
	elif (t[i] % 10 != tmp or flg == 1) and t[i] % 10 != 0:
		ans += (t[i] // 10 + 1) * 10
	elif t[i] % 10 == tmp and flg == 0:
		ans += t[i]
		flg = 1
print(ans)


m = 10
x = 0
for i in range(5):
	n = int(input())
	if n % 10 == 0:
		x += n
		continue
	elif n % 10 < m:
		m = n % 10
	x += n - n % 10 + 10
print(x - 10 + m)


a = [int(input()) for i in range(5)]
sa = [0] * 5
l = [0] * 5
for i in range(5):
	l[i] = 10 * ((a[i] + 9) // 10)
	sa[i] = 10 * ((a[i] + 9) // 10) - a[i]
print(sum(l) - max(sa))


import math
L = [int(input()) for _ in range(5)]
T = [math.ceil(l / 10) * 10 - l for l in L]
print(sum(L) + sum(T) - max(T))


a = eval('int(input()),' * 5)
b = [-i - -i // 10 * 10 for i in a]
print(sum(b) + sum(a) - max(b))


r = [int(input()) for i in range(5)]
import math
print(sum(sorted([math.ceil(x * 0.1) * 10 - x for x in r])[:4]) + sum(r))


import math
l = [int(input()) for _ in range(5)]
l2 = [math.ceil(i / 10) * 10 for i in l]
diff = max([i - j for (i, j) in zip(l2, l)])
print(sum(l2) - diff)


l = [int(input()) for _ in range(5)]
m = [(x + 9) // 10 * 10 for x in l]
s = sum(m)
print(min([s - m[i] + l[i] for i in range(5)]))


S = [int(input()) for _ in range(5)]
T = []
for i in range(5):
	T.append((10 - S[i]) % 10)
print(sum(S) + sum(T) - max(T))


foods = [int(input()) for _ in range(5)]
last = foods.pop(foods.index(min(foods, key=lambda x: (x - 1) % 10)))
print(sum(map(lambda x: (x + 9) // 10 * 10, foods)) + last)


q = -1
r = 10
for i in range(5):
	k = int(input())
	q += (k - 1) // 10 + 1
	r = min(r - 1, (k - 1) % 10) + 1
print(q * 10 + r)


import sys
import copy
import math
import itertools
import numpy as np
l = [int(input()) for c in range(5)]
tmp = 0
cnt = 5
for i in range(5):
	if tmp < 10 - l[i] % 10 and l[i] % 10 != 0:
		tmp = 10 - l[i] % 10
		cnt = i
res = 0
for i in range(5):
	if cnt == i:
		res += l[i]
	elif l[i] % 10 == 0:
		res += l[i]
	else:
		res += l[i] + 10 - l[i] % 10
print(res)


a = [int(input()) for i in range(5)]
m = 0
n = 0
for i in a:
	if i % 10 != 0:
		t = 10 - i % 10
	else:
		t = 0
	n += i + t
	m = max(m, t)
print(n - m)


(*A,) = map(int, open(0).read().split())
B = [(10 - a % 10) % 10 for a in A]
print(sum(A) + sum(B) - max(B))


ans = 0
l = [int(input()) for _ in range(5)]
m = [10 - p % 10 for p in l if p % 10 != 0]
print(sum(l) + sum(sorted(m)[:-1]))


a = int(input())
t = -a // 10 * -10
f = (a - 1) % 10
for i in range(4):
	a = int(input())
	t += -a // 10 * -10
	f = min(f, (a - 1) % 10)
print(t - 9 + f)


time = [int(input()) for _ in range(5)]
new_time = []
amari = 10
for x in time:
	if x % 10 == 0:
		new_time.append(x)
	else:
		amari = min(amari, x % 10)
		new_time.append(10 * (x // 10 + 1))
total = sum(new_time)
dead = 10 - amari
print(total - dead)


a = []
for _ in range(5):
	a.append(int(input()))
c = 0
d = 0
for i in range(5):
	b = a[i] % 10
	if b != 0 and abs(10 - b) > c:
		c = abs(10 - b)
		d = i
e = a.pop(d)
f = 0
for j in a:
	g = j % 10
	if g == 0:
		f += j
	else:
		f += (j // 10 + 1) * 10
f += e
print(f)


A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
L = [(10 - A % 10) % 10, (10 - B % 10) % 10, (10 - C % 10) % 10, (10 - D % 10) % 10, (10 - E % 10) % 10]
L.sort()
print(A + B + C + D + E + L[0] + L[1] + L[2] + L[3])


Z = [int(input()) for _ in range(5)]
ans = 0
r = 0
for z in Z:
	time = (z + 9) // 10 * 10
	r = max(r, time - z)
	ans += time
print(ans - r)


foods = [0] * 5
sumfoods = 0
for i in range(5):
	foods[i] = int(input())
maxDiv = 0
for (i, var) in enumerate(foods):
	temp = 10 - var % 10
	if temp == 10:
		temp = 0
	foods[i] += temp
	sumfoods += foods[i]
	if maxDiv < temp:
		maxDiv = temp
print(sumfoods - maxDiv)


from math import ceil
orders = list((int(input()) for _ in range(5)))
total = 0
maximum = 0
for order in orders:
	time = ceil(order / 10) * 10
	total += time
	delta = time - order
	maximum = max(maximum, delta)
print(total - maximum)


Value = [int(input()) for _ in range(5)]
amari = list()
for i in range(5):
	if Value[i] % 10 == 0:
		amari.append(10)
	else:
		amari.append(Value[i] % 10)
min_amari = [i for i in range(5) if min(amari) == amari[i]]
ans = 0
for i in range(5):
	if i == min_amari[0]:
		ans += 0
	else:
		ans += Value[i] + 10 - amari[i]
ans += Value[min_amari[0]]
print(ans)


x = [int(input()) for i in range(5)]
ans = 0
gap = []
for i in x:
	y = -i // 10 * -10
	ans += y
	gap.append(y - i)
ans = ans - max(gap)
print(ans)


order = [int(input()) for _ in range(5)]
max_order = [-(-i // 10) * 10 - i for i in order]
print(sum(order) + sum(max_order) - max(max_order))


l = [int(input()) for i in range(5)]
s = []
for i in range(5):
	s.append(((l[i] // 10 + 1) * 10 - l[i]) % 10)
print(sum(l) + sum(s) - max(s))


mr = 0
sm = 0
for i in range(5):
	nm = int(input())
	r = (10 - nm % 10) % 10
	sm += nm + r
	mr = max(r, mr)
print(sm - mr)


from math import ceil
a = []
m = 0
for _ in range(5):
	x = int(input())
	y = ceil(x / 10) * 10
	a.append(y)
	m = max(m, y - x)
print(sum(a) - m)


li2 = []
c = 0
for i in range(5):
	a = int(input())
	li2.append((a - 1) % 10 + 1)
	c += (a - 1) // 10 + 1
li2.sort()
print(c * 10 + li2[0] - 10)


time = [int(input()) for _ in range(5)]
loss = [(10 - x % 10) % 10 for x in time]
loss.sort()
loss.pop(-1)
print(sum(time) + sum(loss))


l = sorted(list(map(int, open(0))), key=lambda x: -x % 10)
print(sum([i + -i % 10 for i in l[:4]]) + l[4])


X = [int(input()) for i in range(5)]
Y = []
for x in X:
	Y.append(-(-x // 10) * 10 - x)
print(sum(X) + sum(Y) - max(Y))


a = []
b = []
c = []
for i in range(5):
	a.append(int(input()))
for i in a:
	b.append(i % 10)
for i in b:
	c.append((10 - i) % 10)
d = max(c)
print(sum(a) + sum(c) - d)


LIST = [int(input()) for i in range(5)]
LIST.sort(key=lambda x: 10 - (x - 1) % 10)
ANS = 0
for i in range(4):
	ANS += -(-LIST[i] // 10) * 10
print(ANS + LIST[-1])


T = [int(input()) for i in range(5)]
t = sorted(T, key=lambda x: (x - 1) % 10)
result = sum(((x + 9) // 10 * 10 for x in t[1:])) + t[0]
print(result)


from math import ceil as c
a = [int(input()) for i in range(5)]
print(sum([c(i / 10) for i in a]) * 10 - max([c(i / 10) * 10 - i for i in a]))


a = [int(input()) for _ in range(5)]
ans = 0
for i in a:
	ans += ((i - 1) // 10 + 1) * 10
r = []
for i in a:
	r.append((i - 1) % 10 + 1)
r.sort()
ans -= 10 - r[0]
print(ans)


a = [int(input()) for i in range(5)]
ans = 0
d1 = 10
for i in range(5):
	ans += (a[i] + 9) // 10 * 10
	if a[i] % 10:
		d1 = min(d1, a[i] % 10)
print(ans + d1 - 10)


def f(v):
	y = 0
	for x in v:
		y = (y + 9) // 10 * 10 + x
	return y
print(min((f(x) for x in __import__('itertools').permutations((int(input()) for _ in [0] * 5)))))


s = m = 0
for a in open(0).readlines():
	a = int(a)
	t = (a + 9) // 10 * 10
	s += t
	m = max(m, t - a)
print(s - m)


dishes = []
for i in range(5):
	dishes.append(int(input()))
wasted_times = []
for dish in dishes:
	wasted_time = (10 - dish % 10) % 10
	wasted_times.append(wasted_time)
wasted_times.sort()
del wasted_times[-1]
ans = sum(dishes) + sum(wasted_times)
print(ans)


a = [int(input()) for _ in range(5)]
a = sorted(a, key=lambda x: -x % 10)
print(sum((x + -x % 10 for x in a[:-1])) + a[-1])


foods = [int(input()) for i in range(5)]
kiriage = [-(-i // 10) * 10 for i in foods]
amari = [-(-i // 10) * 10 - i for i in foods]
print(sum(kiriage) - max(amari))


A = []
for _ in range(5):
	A.append(int(input()))
ans = sum([-10 * (-i // 10) for i in A])
ans -= max([(10 - i % 10) % 10 for i in A])
print(ans)


abcde = [int(input()) for _ in range(5)]
s = list(map(lambda x: (10 - x % 10) % 10, abcde))
print(sum(abcde) + sum(s) - max(s))


import math
dishes = []
rest = 10
for i in range(5):
	n = int(input())
	dishes.append(math.ceil(n / 10) * 10)
	if 0 < n % 100 % 10 < rest:
		rest = n % 100 % 10
print(sum(dishes) - (10 - rest))


a = list((int(input()) for _ in range(5)))
print(sum(map(lambda x: (x + 9) // 10 * 10, a)) - max(map(lambda x: (10 - x % 10) % 10, a)))


A = [int(input()) for _ in range(5)]
d = 0
t = 0
for a in A:
	if a % 10:
		d = max(d, 10 - a % 10)
		t += a - a % 10 + 10
	else:
		t += a
print(t - d)


(*a,) = map(int, open(0))
print(min((~-i % 10 for i in a)) - sum((-i // 10 * 10 for i in a)) - 9)


(*a,) = map(int, open(0))
print(-max((-j % 10 for j in a)) - sum((-i // 10 for i in a)) * 10)


import math
x = 0
ans = 0
for i in range(5):
	a = int(input())
	b = math.ceil(a / 10) * 10
	x = max(x, b - a)
	ans += b
print(ans - x)


u = []
time = 0
for i in range(5):
	s = int(input())
	t = (s + 9) // 10 * 10
	u.append(t - s)
	time += t
print(time - max(u))


a = [int(input()) for _ in range(5)]
import math
b = [math.ceil(i / 10) * 10 - i for i in a]
print(sum(a) + sum(b) - max(b))


A = [int(input()) for n in range(5)]
B = [(a + 9) // 10 * 10 for a in A]
C = sum(B)
print(min([C - B[n] + A[n] for n in range(5)]))


a = [int(input()) for _ in [0] * 5]
b = [-(-i // 10) * 10 - i for i in a]
print(sum(b) + sum(a) - max(b))


ret = 0
m = 10
for _ in range(5):
	y = int(input())
	ret += (y + 9) // 10 * 10
	if y % 10 != 0:
		m = min(m, y % 10)
print(ret - (10 - m))


a = 0
l = []
for _ in range(5):
	x = int(input())
	a += x
	l += [(200 - x) % 10]
print(a + sum(l) - max(l))


time = []
ans = 0
for i in range(5):
	A = int(input())
	a = 10 - A % 10
	ans += A + a % 10
	time.append(a % 10)
time.sort()
ans -= time[-1]
print(ans)