# 2019/04/06
# AtCoder Beginner Contest 123 - B

# Input
sum = 0
cl = list()
hmin = 99
minidx = -1

for i in range(5):
    wt = int(input())
    t = int((wt + 9) / 10) * 10
    sum += t
    cl.append(wt)
    wh = wt % 10
    if wh > 0 and wh < hmin:
        hmin = wt % 10
        minidx = i

print(hmin)
if hmin < 99:
    sum = sum - (10 - hmin)

# Output
print(sum)
