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

a_s=a/10
a_a=a%10
b_s=b/10
b_a=b%10
c_s=c/10
c_a=c%10
d_s=d/10
d_a=d%10
e_s=e/10
e_a=e%10
A=[]
A.append(a_a)
A.append(b_a)
A.append(c_a)
A.append(d_a)
A.append(e_a)
ans+=(a_s + b_s + c_s + d_s + e_s)*10
A.sort()
for i in range(5):
    if A[i]!=0:
        ans += A[i]
        ans += (5-(i+1))*10
        break

print(ans)
