"""

author : halo2halo

date : 9, Jan, 2020

"""



import sys



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10 ** 7)



import numpy as np



DISH = list(map(int, read().split()))



temp = 10

im = 0

for num, i in enumerate(DISH):

    if i % 10 < temp and i % 10 != 0:

        temp = i % 10

        im = num



ans = 0

for num, i in enumerate(DISH):

    if num != im:

        ans += ((i + 9) // 10) * 10

    else:

        ans += i

print(ans)

"""

author : halo2halo

date : 9, Jan, 2020

"""



import sys



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10 ** 7)





DISH = list(map(int, read().split()))



temp = 10

im = 0

for num, i in enumerate(DISH):

    if i % 10 < temp and i % 10 != 0:

        temp = i % 10

        im = num



ans = 0

for num, i in enumerate(DISH):

    if num != im:

        ans += ((i + 9) // 10) * 10

    else:

        ans += i

print(ans)

"""
author : halo2halo
date : 9, Jan, 2020
"""
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
import numpy as np

DISH = list(map(int, read().split()))
temp = 10
im = 0
for num, i in enumerate(DISH):
    if i % 10 < temp and i % 10 != 0:
        temp = i % 10
        im = num
ans = 0
for num, i in enumerate(DISH):
    if num != im:
        ans += ((i + 9) // 10) * 10
    else:
        ans += i
print(ans)

"""
author : halo2halo
date : 9, Jan, 2020
"""
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
DISH = list(map(int, read().split()))
temp = 10
im = 0
for num, i in enumerate(DISH):
    if i % 10 < temp and i % 10 != 0:
        temp = i % 10
        im = num
ans = 0
for num, i in enumerate(DISH):
    if num != im:
        ans += ((i + 9) // 10) * 10
    else:
        ans += i
print(ans)

-import numpy as np -