result = 0
A = list()
for i in xrange(5):
    tmp = int(raw_input())
    A.append(tmp)
    result += int(tmp/10) * 10
print result

min = 10
red_count = 0
for i in xrange(5):
    if A[i] % 10 == 0: red_count += 1
    elif min > A[i] % 10:
        min = A[i] % 10

if min == 10: print result
else: print (result+10*(4-red_count)+min)
    