#!/usr/bin/env python3



import re

a = []

b = []

for i in range(5):

    x = int(eval(input()))

    a.append(x)

    x = x%10

    b.append(x)



count = 0

min = 123

k = 0

for i in range(5):

    if(b[i] != 0 and min > b[i]):

        min = b[i]

        k = i



for i in range(5):

    if(i != k and b[i] != 0):

        count += a[i] + 10 - b[i]

    elif(i == k or b[i] == 0):

        count += a[i]

print(count)

#!/usr/bin/env python3

#ABC123 B



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

LI2 = [LI[i] % 10 for i in range(5)]



x = [(LI[i],LI2[i]) for i in range(5)]

#print(x)



ans = 0

x = sorted(x, key = lambda x:x[1],reverse = True)

for i in range(5):

    if x[i][1] == 0:

        t = x[i]

        x.remove(t)

        x.insert(0,t)

#print(x)



for i in range(4):

    if x[i][1] != 0:

        ans += x[i][0] + (10 - x[i][1])

    else:

        ans += x[i][0]

ans += x[4][0]

print(ans)
#!/usr/bin/env python3
import re

a = []
b = []
for i in range(5):
    x = int(eval(input()))
    a.append(x)
    x = x % 10
    b.append(x)
count = 0
min = 123
k = 0
for i in range(5):
    if b[i] != 0 and min > b[i]:
        min = b[i]
        k = i
for i in range(5):
    if i != k and b[i] != 0:
        count += a[i] + 10 - b[i]
    elif i == k or b[i] == 0:
        count += a[i]
print(count)

#!/usr/bin/env python3
# ABC123 B
LI = [int(eval(input())) for _ in range(5)]
LI2 = [LI[i] % 10 for i in range(5)]
x = [(LI[i], LI2[i]) for i in range(5)]
# print(x)
ans = 0
x = sorted(x, key=lambda x: x[1], reverse=True)
for i in range(5):
    if x[i][1] == 0:
        t = x[i]
        x.remove(t)
        x.insert(0, t)
# print(x)
for i in range(4):
    if x[i][1] != 0:
        ans += x[i][0] + (10 - x[i][1])
    else:
        ans += x[i][0]
ans += x[4][0]
print(ans)

-import re - -a = [] -b = [] +# ABC123 B +LI = [int(eval(input())) for _ in range(5)] +LI2 = [LI[i] % 10 for i in range(5)] +x = [(LI[i], LI2[i]) for i in range(5)] +# print(x) +ans = 0 +x = sorted(x, key=lambda x: x[1], reverse=True) -    x = int(eval(input())) -    a.append(x) -    x = x % 10 -    b.append(x) -count = 0 -min = 123 -k = 0 -for i in range(5): -    if b[i] != 0 and min > b[i]: -        min = b[i] -        k = i -for i in range(5): -    if i != k and b[i] != 0: -        count += a[i] + 10 - b[i] -    elif i == k or b[i] == 0: -        count += a[i] -print(count) +    if x[i][1] == 0: +        t = x[i] +        x.remove(t) +        x.insert(0, t) +# print(x) +for i in range(4): +    if x[i][1] != 0: +        ans += x[i][0] + (10 - x[i][1]) +    else: +        ans += x[i][0] +ans += x[4][0] +print(ans)