A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
aw = int(A/10)*10 + 10
bw = int(B/10)*10 + 10
cw = int(C/10)*10 + 10
dw = int(D/10)*10 + 10
ew = int(E/10)*10 + 10
V1 = [A,B,C,D,E]
V2 = [aw,bw,cw,bw,ew]
V3 = [V2[j] - V1[j] for j in range(0,5)]
mx = V3.index(max(V3))
print(aw + bw + cw + dw + ew - V2[mx] + V1[mx])