a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ra = math.ceil(a / 10) * 10 - a
rb = math.ceil(b / 10) * 10 - b
rc = math.ceil(c / 10) * 10 - c
rd = math.ceil(d / 10) * 10 - d
re = math.ceil(e / 10) * 10 - e

ans = a + b + c + d + e + ra + rb + rc + rd + re - max(ra, rb, rc, rd, re)

print(ans)