import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

res = 0
li = []
dic = {}
for i in range(5):
    li.append(int(input()))
for i in range(5):
    if li[i] % 10 != 0 and li[i] % 10 not in dic.values():
        dic[i] = li[i] % 10
m = min(dic.values())
for j in range(5):
    if li[j] % 10 == 0:
        res += li[j]
    else:
        if li[j] % 10 == m and j in dic.keys():
            res += li[j]
        else:
            res += (li[j] // 10 + 1) * 10
print(res)