L = []
for i in range(5):
    L.append(int(input()))

L1 = [x for x in L if x%10 == 0]
L2 = [x for x in L if x%10 != 0]
L3 = [(x%10,x//10) for x in L2]

ans = sum(L1)
L3.sort(reverse = True)

for i in range(len(L3)-1):
    ans += (L3[i][1]+1)*10
ans += L3[-1][1]*10+L3[-1][0]
print(ans) 