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

abcde = list(map(int, read().split()))
check = sorted([abcde[0] % 10, abcde[1] % 10, abcde[2] % 10, abcde[3] % 10, abcde[4] % 10])
for i in range(5):
    if check[0] == 0:
        check.pop(0)
    else:
        break
if not check:
    check = [0]
ans = 0
for v in abcde:
    if v % 10 == check[0] or v % 10 == 0:
        ans += v
    else:
        ans += (v - v % 10) + 10
print(ans)
